aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/file.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@kernel.org>2021-06-18 13:05:06 -0400
committerIlya Dryomov <idryomov@gmail.com>2021-06-29 00:15:52 +0200
commit4c18347238ab5a4ee0e71ca765460d84c75a26b5 (patch)
treeb6ab8e47ccb7d6e50ea4a5ccdf4aba6bd50133b1 /fs/ceph/file.c
parentceph: eliminate ceph_async_iput() (diff)
downloadlinux-dev-4c18347238ab5a4ee0e71ca765460d84c75a26b5.tar.xz
linux-dev-4c18347238ab5a4ee0e71ca765460d84c75a26b5.zip
ceph: take reference to req->r_parent at point of assignment
Currently, we set the r_parent pointer but then don't take a reference to it until we submit the request. If we end up freeing the req before that point, then we'll do a iput when we shouldn't. Instead, take the inode reference in the callers, so that it's always safe to call ceph_mdsc_put_request on the req, even before submission. Signed-off-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: Luis Henriques <lhenriques@suse.de> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/file.c')
-rw-r--r--fs/ceph/file.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 707102f5cad9..d1755ac1d964 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -706,6 +706,7 @@ retry:
mask |= CEPH_CAP_XATTR_SHARED;
req->r_args.open.mask = cpu_to_le32(mask);
req->r_parent = dir;
+ ihold(dir);
if (flags & O_CREAT) {
struct ceph_file_layout lo;