| Start/ | End/ | |||
| True | False | - | Line | Source |
| 1 | /* | |||
| 2 | * linux/fs/nfs/callback_proc.c | |||
| 3 | * | |||
| 4 | * Copyright (C) 2004 Trond Myklebust | |||
| 5 | * | |||
| 6 | * NFSv4 callback procedures | |||
| 7 | */ | |||
| 8 | #include <linux/config.h> | |||
| 9 | #include <linux/nfs4.h> | |||
| 10 | #include <linux/nfs_fs.h> | |||
| 11 | #include "nfs4_fs.h" | |||
| 12 | #include "callback.h" | |||
| 13 | #include "delegation.h" | |||
| 14 | ||||
| 15 | #define NFSDBG_FACILITY NFSDBG_CALLBACK | |||
| 16 | ||||
| 0 | 0 | - | 17 | unsigned nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *res) |
| 18 | { | |||
| 19 | struct nfs4_client *clp; | |||
| 20 | struct nfs_delegation *delegation; | |||
| 21 | struct nfs_inode *nfsi; | |||
| 22 | struct inode *inode; | |||
| 23 | ||||
| 24 | res->bitmap[0] = res->bitmap[1] = 0; | |||
| 25 | res->status = htonl(NFS4ERR_BADHANDLE); | |||
| 0 | 0 | - | 25 | ternary-?: __builtin_constant_p ( ( __u32 ) ( .. |
| 26 | clp = nfs4_find_client(&args->addr->sin_addr); | |||
| 0 | 0 | - | 27 | if (clp == NULL) |
| 0 | - | 28 | goto out; | |
| 29 | inode = nfs_delegation_find_inode(clp, &args->fh); | |||
| 0 | 0 | - | 30 | if (inode == NULL) |
| 0 | - | 31 | goto out_putclient; | |
| 32 | nfsi = NFS_I(inode); | |||
| 33 | down_read(&nfsi->rwsem); | |||
| 34 | delegation = nfsi->delegation; | |||
| 0 | 0 | - | 35 | if (delegation == NULL || (delegation->type & FMODE_WRITE) == 0) |
| 0 | - | 35 | T || _ | |
| 0 | - | 35 | F || T | |
| 0 | - | 35 | F || F | |
| 0 | - | 36 | goto out_iput; | |
| 37 | res->size = i_size_read(inode); | |||
| 38 | res->change_attr = delegation->change_attr; | |||
| 0 | 0 | - | 39 | if (nfsi->npages != 0) |
| 40 | res->change_attr++; | |||
| 41 | res->ctime = inode->i_ctime; | |||
| 42 | res->mtime = inode->i_mtime; | |||
| 43 | res->bitmap[0] = (FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE) & | |||
| 44 | args->bitmap[0]; | |||
| 45 | res->bitmap[1] = (FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY) & | |||
| 46 | args->bitmap[1]; | |||
| 47 | res->status = 0; | |||
| 48 | out_iput: | |||
| 49 | up_read(&nfsi->rwsem); | |||
| 50 | iput(inode); | |||
| 51 | out_putclient: | |||
| 52 | nfs4_put_client(clp); | |||
| 53 | out: | |||
| 54 | dprintk("%s: exit with status = %d\n", __FUNCTION__, ntohl(res->status)); | |||
| 0 | 0 | - | 54 | if (__builtin_expect ( ! ! ( nfs_debug & 0x0.. |
| 0 | 0 | - | 54 | ternary-?: __builtin_constant_p ( ( __u32 .. |
| 0 | 0 | - | 54 | do-while (0) |
| 0 | - | 55 | return res->status; | |
| 56 | } | |||
| 57 | ||||
| 0 | 0 | - | 58 | unsigned nfs4_callback_recall(struct cb_recallargs *args, void *dummy) |
| 59 | { | |||
| 60 | struct nfs4_client *clp; | |||
| 61 | struct inode *inode; | |||
| 62 | unsigned res; | |||
| 63 | ||||
| 64 | res = htonl(NFS4ERR_BADHANDLE); | |||
| 0 | 0 | - | 64 | ternary-?: __builtin_constant_p ( ( __u32 ) ( .. |
| 65 | clp = nfs4_find_client(&args->addr->sin_addr); | |||
| 0 | 0 | - | 66 | if (clp == NULL) |
| 0 | - | 67 | goto out; | |
| 68 | inode = nfs_delegation_find_inode(clp, &args->fh); | |||
| 0 | 0 | - | 69 | if (inode == NULL) |
| 0 | - | 70 | goto out_putclient; | |
| 71 | /* Set up a helper thread to actually return the delegation */ | |||
| 72 | switch(nfs_async_inode_return_delegation(inode, &args->stateid)) { | |||
| 0 | - | 73 | case 0: | |
| 74 | res = 0; | |||
| 0 | - | 75 | break; | |
| 0 | - | 76 | case -ENOENT: | |
| 77 | res = htonl(NFS4ERR_BAD_STATEID); | |||
| 0 | 0 | - | 77 | ternary-?: __builtin_constant_p ( ( __u32 ) .. |
| 0 | - | 78 | break; | |
| 0 | - | 79 | default: | |
| 80 | res = htonl(NFS4ERR_RESOURCE); | |||
| 0 | 0 | - | 80 | ternary-?: __builtin_constant_p ( ( __u32 ) .. |
| 81 | } | |||
| 82 | iput(inode); | |||
| 83 | out_putclient: | |||
| 84 | nfs4_put_client(clp); | |||
| 85 | out: | |||
| 86 | dprintk("%s: exit with status = %d\n", __FUNCTION__, ntohl(res)); | |||
| 0 | 0 | - | 86 | if (__builtin_expect ( ! ! ( nfs_debug & 0x0.. |
| 0 | 0 | - | 86 | ternary-?: __builtin_constant_p ( ( __u32 .. |
| 0 | 0 | - | 86 | do-while (0) |
| 0 | - | 87 | return res; | |
| 88 | } | |||
| ***TER 0% (0/49) of SOURCE FILE callback_proc.c | ||||