aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/readdir.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-04-20 17:40:47 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2016-05-02 19:49:31 -0400
commit3125d2650cae97d8f313ab696cd0ed66916e767a (patch)
tree096f2443ed0cd35a6701add31eaa83dcba16c2a8 /fs/cifs/readdir.c
parentd9b3dbdcfd6213731c3eb985a3a83537e3894e12 (diff)
cifs: switch to ->iterate_shared()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/cifs/readdir.c')
-rw-r--r--fs/cifs/readdir.c55
1 files changed, 29 insertions, 26 deletions
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 4cfb4d9f88e2..867439c21001 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -80,18 +80,32 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name,
80 struct inode *inode; 80 struct inode *inode;
81 struct super_block *sb = parent->d_sb; 81 struct super_block *sb = parent->d_sb;
82 struct cifs_sb_info *cifs_sb = CIFS_SB(sb); 82 struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
83 DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wq);
83 84
84 cifs_dbg(FYI, "%s: for %s\n", __func__, name->name); 85 cifs_dbg(FYI, "%s: for %s\n", __func__, name->name);
85 86
86 dentry = d_hash_and_lookup(parent, name); 87 dentry = d_hash_and_lookup(parent, name);
88 if (!dentry) {
89 /*
90 * If we know that the inode will need to be revalidated
91 * immediately, then don't create a new dentry for it.
92 * We'll end up doing an on the wire call either way and
93 * this spares us an invalidation.
94 */
95 if (fattr->cf_flags & CIFS_FATTR_NEED_REVAL)
96 return;
97retry:
98 dentry = d_alloc_parallel(parent, name, &wq);
99 }
87 if (IS_ERR(dentry)) 100 if (IS_ERR(dentry))
88 return; 101 return;
89 102 if (!d_in_lookup(dentry)) {
90 if (dentry) {
91 inode = d_inode(dentry); 103 inode = d_inode(dentry);
92 if (inode) { 104 if (inode) {
93 if (d_mountpoint(dentry)) 105 if (d_mountpoint(dentry)) {
94 goto out; 106 dput(dentry);
107 return;
108 }
95 /* 109 /*
96 * If we're generating inode numbers, then we don't 110 * If we're generating inode numbers, then we don't
97 * want to clobber the existing one with the one that 111 * want to clobber the existing one with the one that
@@ -106,33 +120,22 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name,
106 (inode->i_mode & S_IFMT) == 120 (inode->i_mode & S_IFMT) ==
107 (fattr->cf_mode & S_IFMT)) { 121 (fattr->cf_mode & S_IFMT)) {
108 cifs_fattr_to_inode(inode, fattr); 122 cifs_fattr_to_inode(inode, fattr);
109 goto out; 123 dput(dentry);
124 return;
110 } 125 }
111 } 126 }
112 d_invalidate(dentry); 127 d_invalidate(dentry);
113 dput(dentry); 128 dput(dentry);
129 goto retry;
130 } else {
131 inode = cifs_iget(sb, fattr);
132 if (!inode)
133 inode = ERR_PTR(-ENOMEM);
134 alias = d_splice_alias(inode, dentry);
135 d_lookup_done(dentry);
136 if (alias && !IS_ERR(alias))
137 dput(alias);
114 } 138 }
115
116 /*
117 * If we know that the inode will need to be revalidated immediately,
118 * then don't create a new dentry for it. We'll end up doing an on
119 * the wire call either way and this spares us an invalidation.
120 */
121 if (fattr->cf_flags & CIFS_FATTR_NEED_REVAL)
122 return;
123
124 dentry = d_alloc(parent, name);
125 if (!dentry)
126 return;
127
128 inode = cifs_iget(sb, fattr);
129 if (!inode)
130 goto out;
131
132 alias = d_splice_alias(inode, dentry);
133 if (alias && !IS_ERR(alias))
134 dput(alias);
135out:
136 dput(dentry); 139 dput(dentry);
137} 140}
138 141