aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/export.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@kernel.org>2021-02-25 15:04:15 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2021-03-08 10:19:36 -0500
commit3e10a15ffc8d77f05e655d14fd48c0b790dede35 (patch)
treea17d57ad4dea11482c47292192fa89c548dcf2fd /fs/ceph/export.c
parentnew helper: inode_wrong_type() (diff)
downloadlinux-dev-3e10a15ffc8d77f05e655d14fd48c0b790dede35.tar.xz
linux-dev-3e10a15ffc8d77f05e655d14fd48c0b790dede35.zip
ceph: fix up error handling with snapdirs
There are several warts in the snapdir error handling. The -EOPNOTSUPP return in __snapfh_to_dentry is currently lost, and the call to ceph_handle_snapdir is not currently checked at all. Fix all of this up and eliminate a BUG_ON in ceph_get_snapdir. We can handle that case with a warning and return an error. Signed-off-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ceph/export.c')
-rw-r--r--fs/ceph/export.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/ceph/export.c b/fs/ceph/export.c
index e088843a7734..f22156ee7306 100644
--- a/fs/ceph/export.c
+++ b/fs/ceph/export.c
@@ -248,9 +248,10 @@ static struct dentry *__snapfh_to_dentry(struct super_block *sb,
ihold(inode);
} else {
/* mds does not support lookup snapped inode */
- err = -EOPNOTSUPP;
- inode = NULL;
+ inode = ERR_PTR(-EOPNOTSUPP);
}
+ } else {
+ inode = ERR_PTR(-ESTALE);
}
ceph_mdsc_put_request(req);
@@ -261,8 +262,8 @@ static struct dentry *__snapfh_to_dentry(struct super_block *sb,
dout("snapfh_to_dentry %llx.%llx parent %llx hash %x err=%d",
vino.ino, vino.snap, sfh->parent_ino, sfh->hash, err);
}
- if (!inode)
- return ERR_PTR(-ESTALE);
+ if (IS_ERR(inode))
+ return ERR_CAST(inode);
/* see comments in ceph_get_parent() */
return unlinked ? d_obtain_root(inode) : d_obtain_alias(inode);
}