aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/9p/fid.c9
-rw-r--r--fs/9p/fid.h4
2 files changed, 6 insertions, 7 deletions
diff --git a/fs/9p/fid.c b/fs/9p/fid.c
index afd4724b2d92..71bc36a03e72 100644
--- a/fs/9p/fid.c
+++ b/fs/9p/fid.c
@@ -54,14 +54,13 @@ int v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid)
54 if (!dent) 54 if (!dent)
55 return -ENOMEM; 55 return -ENOMEM;
56 56
57 spin_lock_init(&dent->lock);
58 INIT_LIST_HEAD(&dent->fidlist); 57 INIT_LIST_HEAD(&dent->fidlist);
59 dentry->d_fsdata = dent; 58 dentry->d_fsdata = dent;
60 } 59 }
61 60
62 spin_lock(&dent->lock); 61 spin_lock(&dentry->d_lock);
63 list_add(&fid->dlist, &dent->fidlist); 62 list_add(&fid->dlist, &dent->fidlist);
64 spin_unlock(&dent->lock); 63 spin_unlock(&dentry->d_lock);
65 64
66 return 0; 65 return 0;
67} 66}
@@ -85,14 +84,14 @@ static struct p9_fid *v9fs_fid_find(struct dentry *dentry, kuid_t uid, int any)
85 dent = (struct v9fs_dentry *) dentry->d_fsdata; 84 dent = (struct v9fs_dentry *) dentry->d_fsdata;
86 ret = NULL; 85 ret = NULL;
87 if (dent) { 86 if (dent) {
88 spin_lock(&dent->lock); 87 spin_lock(&dentry->d_lock);
89 list_for_each_entry(fid, &dent->fidlist, dlist) { 88 list_for_each_entry(fid, &dent->fidlist, dlist) {
90 if (any || uid_eq(fid->uid, uid)) { 89 if (any || uid_eq(fid->uid, uid)) {
91 ret = fid; 90 ret = fid;
92 break; 91 break;
93 } 92 }
94 } 93 }
95 spin_unlock(&dent->lock); 94 spin_unlock(&dentry->d_lock);
96 } 95 }
97 96
98 return ret; 97 return ret;
diff --git a/fs/9p/fid.h b/fs/9p/fid.h
index bb0b6e7f58fc..469b5d517694 100644
--- a/fs/9p/fid.h
+++ b/fs/9p/fid.h
@@ -25,7 +25,6 @@
25 25
26/** 26/**
27 * struct v9fs_dentry - 9p private data stored in dentry d_fsdata 27 * struct v9fs_dentry - 9p private data stored in dentry d_fsdata
28 * @lock: protects the fidlist
29 * @fidlist: list of FIDs currently associated with this dentry 28 * @fidlist: list of FIDs currently associated with this dentry
30 * 29 *
31 * This structure defines the 9p private data associated with 30 * This structure defines the 9p private data associated with
@@ -35,11 +34,12 @@
35 * inodes in order to more closely map functionality to the Plan 9 34 * inodes in order to more closely map functionality to the Plan 9
36 * expected behavior for FID reclaimation and tracking. 35 * expected behavior for FID reclaimation and tracking.
37 * 36 *
37 * Protected by ->d_lock of dentry it belongs to.
38 *
38 * See Also: Mapping FIDs to Linux VFS model in 39 * See Also: Mapping FIDs to Linux VFS model in
39 * Design and Implementation of the Linux 9P File System documentation 40 * Design and Implementation of the Linux 9P File System documentation
40 */ 41 */
41struct v9fs_dentry { 42struct v9fs_dentry {
42 spinlock_t lock; /* protect fidlist */
43 struct list_head fidlist; 43 struct list_head fidlist;
44}; 44};
45 45