diff options
Diffstat (limited to 'fs/9p/fid.c')
-rw-r--r-- | fs/9p/fid.c | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/fs/9p/fid.c b/fs/9p/fid.c index 49de4264db9a..ddf618936d8a 100644 --- a/fs/9p/fid.c +++ b/fs/9p/fid.c | |||
@@ -43,25 +43,9 @@ | |||
43 | 43 | ||
44 | int v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid) | 44 | int v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid) |
45 | { | 45 | { |
46 | struct v9fs_dentry *dent; | ||
47 | |||
48 | p9_debug(P9_DEBUG_VFS, "fid %d dentry %s\n", | ||
49 | fid->fid, dentry->d_name.name); | ||
50 | |||
51 | dent = dentry->d_fsdata; | ||
52 | if (!dent) { | ||
53 | dent = kmalloc(sizeof(struct v9fs_dentry), GFP_KERNEL); | ||
54 | if (!dent) | ||
55 | return -ENOMEM; | ||
56 | |||
57 | INIT_HLIST_HEAD(&dent->fidlist); | ||
58 | dentry->d_fsdata = dent; | ||
59 | } | ||
60 | |||
61 | spin_lock(&dentry->d_lock); | 46 | spin_lock(&dentry->d_lock); |
62 | hlist_add_head(&fid->dlist, &dent->fidlist); | 47 | hlist_add_head(&fid->dlist, (struct hlist_head *)&dentry->d_fsdata); |
63 | spin_unlock(&dentry->d_lock); | 48 | spin_unlock(&dentry->d_lock); |
64 | |||
65 | return 0; | 49 | return 0; |
66 | } | 50 | } |
67 | 51 | ||
@@ -75,18 +59,18 @@ int v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid) | |||
75 | 59 | ||
76 | static struct p9_fid *v9fs_fid_find(struct dentry *dentry, kuid_t uid, int any) | 60 | static struct p9_fid *v9fs_fid_find(struct dentry *dentry, kuid_t uid, int any) |
77 | { | 61 | { |
78 | struct v9fs_dentry *dent; | ||
79 | struct p9_fid *fid, *ret; | 62 | struct p9_fid *fid, *ret; |
80 | 63 | ||
81 | p9_debug(P9_DEBUG_VFS, " dentry: %s (%p) uid %d any %d\n", | 64 | p9_debug(P9_DEBUG_VFS, " dentry: %s (%p) uid %d any %d\n", |
82 | dentry->d_name.name, dentry, from_kuid(&init_user_ns, uid), | 65 | dentry->d_name.name, dentry, from_kuid(&init_user_ns, uid), |
83 | any); | 66 | any); |
84 | dent = (struct v9fs_dentry *) dentry->d_fsdata; | ||
85 | ret = NULL; | 67 | ret = NULL; |
86 | if (dent) { | 68 | /* we'll recheck under lock if there's anything to look in */ |
69 | if (dentry->d_fsdata) { | ||
70 | struct hlist_head *h = (struct hlist_head *)&dentry->d_fsdata; | ||
87 | struct hlist_node *n; | 71 | struct hlist_node *n; |
88 | spin_lock(&dentry->d_lock); | 72 | spin_lock(&dentry->d_lock); |
89 | hlist_for_each_entry(fid, n, &dent->fidlist, dlist) { | 73 | hlist_for_each_entry(fid, n, h, dlist) { |
90 | if (any || uid_eq(fid->uid, uid)) { | 74 | if (any || uid_eq(fid->uid, uid)) { |
91 | ret = fid; | 75 | ret = fid; |
92 | break; | 76 | break; |