Loading fs/nfs/delegation.c +10 −6 Original line number Diff line number Diff line Loading @@ -694,21 +694,25 @@ int nfs_delegations_present(struct nfs_client *clp) * nfs4_copy_delegation_stateid - Copy inode's state ID information * @dst: stateid data structure to fill in * @inode: inode to check * @flags: delegation type requirement * * Returns one and fills in "dst->data" * if inode had a delegation, * otherwise zero is returned. * Returns "true" and fills in "dst->data" * if inode had a delegation, * otherwise "false" is returned. */ int nfs4_copy_delegation_stateid(nfs4_stateid *dst, struct inode *inode) bool nfs4_copy_delegation_stateid(nfs4_stateid *dst, struct inode *inode, fmode_t flags) { struct nfs_inode *nfsi = NFS_I(inode); struct nfs_delegation *delegation; int ret = 0; bool ret; flags &= FMODE_READ|FMODE_WRITE; rcu_read_lock(); delegation = rcu_dereference(nfsi->delegation); if (delegation != NULL) { ret = (delegation != NULL && (delegation->type & flags) == flags); if (ret) { nfs4_stateid_copy(dst, &delegation->stateid); ret = 1; nfs_mark_delegation_referenced(delegation); } rcu_read_unlock(); return ret; Loading fs/nfs/delegation.h +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ void nfs_delegation_reap_unclaimed(struct nfs_client *clp); int nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, const nfs4_stateid *stateid, int issync); int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state *state, const nfs4_stateid *stateid); int nfs4_lock_delegation_recall(struct nfs4_state *state, struct file_lock *fl); int nfs4_copy_delegation_stateid(nfs4_stateid *dst, struct inode *inode); bool nfs4_copy_delegation_stateid(nfs4_stateid *dst, struct inode *inode, fmode_t flags); void nfs_mark_delegation_referenced(struct nfs_delegation *delegation); int nfs_have_delegation(struct inode *inode, fmode_t flags); Loading fs/nfs/nfs4proc.c +1 −1 Original line number Diff line number Diff line Loading @@ -1929,7 +1929,7 @@ static int _nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred, nfs_fattr_init(fattr); if (nfs4_copy_delegation_stateid(&arg.stateid, inode)) { if (nfs4_copy_delegation_stateid(&arg.stateid, inode, FMODE_WRITE)) { /* Use that stateid */ } else if (state != NULL) { nfs4_select_rw_stateid(&arg.stateid, state, current->files, current->tgid); Loading Loading
fs/nfs/delegation.c +10 −6 Original line number Diff line number Diff line Loading @@ -694,21 +694,25 @@ int nfs_delegations_present(struct nfs_client *clp) * nfs4_copy_delegation_stateid - Copy inode's state ID information * @dst: stateid data structure to fill in * @inode: inode to check * @flags: delegation type requirement * * Returns one and fills in "dst->data" * if inode had a delegation, * otherwise zero is returned. * Returns "true" and fills in "dst->data" * if inode had a delegation, * otherwise "false" is returned. */ int nfs4_copy_delegation_stateid(nfs4_stateid *dst, struct inode *inode) bool nfs4_copy_delegation_stateid(nfs4_stateid *dst, struct inode *inode, fmode_t flags) { struct nfs_inode *nfsi = NFS_I(inode); struct nfs_delegation *delegation; int ret = 0; bool ret; flags &= FMODE_READ|FMODE_WRITE; rcu_read_lock(); delegation = rcu_dereference(nfsi->delegation); if (delegation != NULL) { ret = (delegation != NULL && (delegation->type & flags) == flags); if (ret) { nfs4_stateid_copy(dst, &delegation->stateid); ret = 1; nfs_mark_delegation_referenced(delegation); } rcu_read_unlock(); return ret; Loading
fs/nfs/delegation.h +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ void nfs_delegation_reap_unclaimed(struct nfs_client *clp); int nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, const nfs4_stateid *stateid, int issync); int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state *state, const nfs4_stateid *stateid); int nfs4_lock_delegation_recall(struct nfs4_state *state, struct file_lock *fl); int nfs4_copy_delegation_stateid(nfs4_stateid *dst, struct inode *inode); bool nfs4_copy_delegation_stateid(nfs4_stateid *dst, struct inode *inode, fmode_t flags); void nfs_mark_delegation_referenced(struct nfs_delegation *delegation); int nfs_have_delegation(struct inode *inode, fmode_t flags); Loading
fs/nfs/nfs4proc.c +1 −1 Original line number Diff line number Diff line Loading @@ -1929,7 +1929,7 @@ static int _nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred, nfs_fattr_init(fattr); if (nfs4_copy_delegation_stateid(&arg.stateid, inode)) { if (nfs4_copy_delegation_stateid(&arg.stateid, inode, FMODE_WRITE)) { /* Use that stateid */ } else if (state != NULL) { nfs4_select_rw_stateid(&arg.stateid, state, current->files, current->tgid); Loading