aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse/dir.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2013-09-05 05:44:43 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-09-05 16:23:54 -0400
commite2a6b95236eba5341253a2e4a50946355f887303 (patch)
treec85bd19135c6a9242e81c30eb0c81091c84d9c03 /fs/fuse/dir.c
parent5835f3390e35ae3da9add646a2ca2cc30b47370e (diff)
fuse: clean up return in fuse_dentry_revalidate()
On errors unrelated to the filesystem's state (ENOMEM, ENOTCONN) return the error itself from ->d_revalidate() insted of returning zero (invalid). Also make a common label for invalidating the dentry. This will be used by the next patch. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/fuse/dir.c')
-rw-r--r--fs/fuse/dir.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 131d14b604ef..25c6cfe98801 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -182,10 +182,11 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
182 struct inode *inode; 182 struct inode *inode;
183 struct dentry *parent; 183 struct dentry *parent;
184 struct fuse_conn *fc; 184 struct fuse_conn *fc;
185 int ret;
185 186
186 inode = ACCESS_ONCE(entry->d_inode); 187 inode = ACCESS_ONCE(entry->d_inode);
187 if (inode && is_bad_inode(inode)) 188 if (inode && is_bad_inode(inode))
188 return 0; 189 goto invalid;
189 else if (fuse_dentry_time(entry) < get_jiffies_64()) { 190 else if (fuse_dentry_time(entry) < get_jiffies_64()) {
190 int err; 191 int err;
191 struct fuse_entry_out outarg; 192 struct fuse_entry_out outarg;
@@ -195,20 +196,23 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
195 196
196 /* For negative dentries, always do a fresh lookup */ 197 /* For negative dentries, always do a fresh lookup */
197 if (!inode) 198 if (!inode)
198 return 0; 199 goto invalid;
199 200
201 ret = -ECHILD;
200 if (flags & LOOKUP_RCU) 202 if (flags & LOOKUP_RCU)
201 return -ECHILD; 203 goto out;
202 204
203 fc = get_fuse_conn(inode); 205 fc = get_fuse_conn(inode);
204 req = fuse_get_req_nopages(fc); 206 req = fuse_get_req_nopages(fc);
207 ret = PTR_ERR(req);
205 if (IS_ERR(req)) 208 if (IS_ERR(req))
206 return 0; 209 goto out;
207 210
208 forget = fuse_alloc_forget(); 211 forget = fuse_alloc_forget();
209 if (!forget) { 212 if (!forget) {
210 fuse_put_request(fc, req); 213 fuse_put_request(fc, req);
211 return 0; 214 ret = -ENOMEM;
215 goto out;
212 } 216 }
213 217
214 attr_version = fuse_get_attr_version(fc); 218 attr_version = fuse_get_attr_version(fc);
@@ -227,7 +231,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
227 struct fuse_inode *fi = get_fuse_inode(inode); 231 struct fuse_inode *fi = get_fuse_inode(inode);
228 if (outarg.nodeid != get_node_id(inode)) { 232 if (outarg.nodeid != get_node_id(inode)) {
229 fuse_queue_forget(fc, forget, outarg.nodeid, 1); 233 fuse_queue_forget(fc, forget, outarg.nodeid, 1);
230 return 0; 234 goto invalid;
231 } 235 }
232 spin_lock(&fc->lock); 236 spin_lock(&fc->lock);
233 fi->nlookup++; 237 fi->nlookup++;
@@ -235,7 +239,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
235 } 239 }
236 kfree(forget); 240 kfree(forget);
237 if (err || (outarg.attr.mode ^ inode->i_mode) & S_IFMT) 241 if (err || (outarg.attr.mode ^ inode->i_mode) & S_IFMT)
238 return 0; 242 goto invalid;
239 243
240 fuse_change_attributes(inode, &outarg.attr, 244 fuse_change_attributes(inode, &outarg.attr,
241 entry_attr_timeout(&outarg), 245 entry_attr_timeout(&outarg),
@@ -249,7 +253,13 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
249 dput(parent); 253 dput(parent);
250 } 254 }
251 } 255 }
252 return 1; 256 ret = 1;
257out:
258 return ret;
259
260invalid:
261 ret = 0;
262 goto out;
253} 263}
254 264
255static int invalid_nodeid(u64 nodeid) 265static int invalid_nodeid(u64 nodeid)