aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index fc0f12ba89cc..24d2fbf549bd 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1009,13 +1009,18 @@ void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx)
1009 spin_unlock(&inode->i_lock); 1009 spin_unlock(&inode->i_lock);
1010} 1010}
1011 1011
1012struct nfs_open_context *nfs_find_open_context(struct inode *inode, int mode) 1012/*
1013 * Given an inode, search for an open context with the desired characteristics
1014 */
1015struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode)
1013{ 1016{
1014 struct nfs_inode *nfsi = NFS_I(inode); 1017 struct nfs_inode *nfsi = NFS_I(inode);
1015 struct nfs_open_context *pos, *ctx = NULL; 1018 struct nfs_open_context *pos, *ctx = NULL;
1016 1019
1017 spin_lock(&inode->i_lock); 1020 spin_lock(&inode->i_lock);
1018 list_for_each_entry(pos, &nfsi->open_files, list) { 1021 list_for_each_entry(pos, &nfsi->open_files, list) {
1022 if (cred != NULL && pos->cred != cred)
1023 continue;
1019 if ((pos->mode & mode) == mode) { 1024 if ((pos->mode & mode) == mode) {
1020 ctx = get_nfs_open_context(pos); 1025 ctx = get_nfs_open_context(pos);
1021 break; 1026 break;