Skip to contentSkip to conversation

ceph: properly put ceph_string reference after async create attempt

PATCH In review Jeff Layton 2 participants 4 messages Jan 25, 2022 – Jan 26, 2022 Ceph client

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ceph: properly put ceph_string reference after async create attempt

The reference acquired by try_prep_async_create is currently leaked. Ensure we put it.

Fixes 9a8d03ca2e2c ("ceph: attempt to do async create when possible")
---
 fs/ceph/file.c | 2 ++
 1 file changed, 2 insertions(+)
fs/ceph/file.c +2 -0
index ea1e9ac6c465..cbe4d5a5cde5 100644
@@ -766,8 +766,10 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
 				restore_deleg_ino(dir, req->r_deleg_ino);
 				ceph_mdsc_put_request(req);
 				try_async = false;
+				ceph_put_string(rcu_dereference_raw(lo.pool_ns));
 				goto retry;
 			}
+			ceph_put_string(rcu_dereference_raw(lo.pool_ns));
 			goto out_req;
 		}
 	}
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 26 lines · Jeff Layton

The reference acquired by try_prep_async_create is currently leaked. Ensure we put it.

Fixes 9a8d03ca2e2c ("ceph: attempt to do async create when possible")
---
 fs/ceph/file.c | 2 ++
 1 file changed, 2 insertions(+)
fs/ceph/file.c +2 -1
index ea1e9ac6c465..cbe4d5a5cde5 100644
@@ -766,8 +766,10 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
                                restore_deleg_ino(dir, req->r_deleg_ino);
                                ceph_mdsc_put_request(req);
                                try_async = false;
+                               ceph_put_string(rcu_dereference_raw(lo.pool_ns));
                                goto retry;
                        }
+                       ceph_put_string(rcu_dereference_raw(lo.pool_ns));
                        goto out_req;
                }
        }
--
Quoted 2 lines

2.34.1

Hi Jeff,

Where is the try_prep_async_create() reference put in case of success? It doesn't look like ceph_finish_async_create() actually consumes it.

Thanks,

Ilya

#2 lore raw
Quoted 32 lines · Ilya Dryomov
Quoted 26 lines · Jeff Layton

The reference acquired by try_prep_async_create is currently leaked. Ensure we put it.

Fixes 9a8d03ca2e2c ("ceph: attempt to do async create when possible")
---
 fs/ceph/file.c | 2 ++
 1 file changed, 2 insertions(+)
fs/ceph/file.c +2 -1
index ea1e9ac6c465..cbe4d5a5cde5 100644
@@ -766,8 +766,10 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
                                restore_deleg_ino(dir, req->r_deleg_ino);
                                ceph_mdsc_put_request(req);
                                try_async = false;
+                               ceph_put_string(rcu_dereference_raw(lo.pool_ns));
                                goto retry;
                        }
+                       ceph_put_string(rcu_dereference_raw(lo.pool_ns));
                        goto out_req;
                }
        }
--
Quoted 2 lines

2.34.1

Hi Jeff,

Quoted 3 lines

Where is the try_prep_async_create() reference put in case of success? It doesn't look like ceph_finish_async_create() actually consumes it.

The second call above puts it in the case of success, or in the case of any error that isn't -EJUKEBOX.

Signature · 1 line
Jeff Layton <[email protected]>
maintainer Reviewed-by
#3 lore raw
Quoted 34 lines · Jeff Layton
Quoted 32 lines · Ilya Dryomov
Quoted 26 lines · Jeff Layton

The reference acquired by try_prep_async_create is currently leaked. Ensure we put it.

Fixes 9a8d03ca2e2c ("ceph: attempt to do async create when possible")
---
 fs/ceph/file.c | 2 ++
 1 file changed, 2 insertions(+)
fs/ceph/file.c +2 -1
index ea1e9ac6c465..cbe4d5a5cde5 100644
@@ -766,8 +766,10 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
                                restore_deleg_ino(dir, req->r_deleg_ino);
                                ceph_mdsc_put_request(req);
                                try_async = false;
+                               ceph_put_string(rcu_dereference_raw(lo.pool_ns));
                                goto retry;
                        }
+                       ceph_put_string(rcu_dereference_raw(lo.pool_ns));
                        goto out_req;
                }
        }
--
Quoted 2 lines

2.34.1

Hi Jeff,

Quoted 6 lines
Quoted 3 lines

Where is the try_prep_async_create() reference put in case of success? It doesn't look like ceph_finish_async_create() actually consumes it.

The second call above puts it in the case of success, or in the case of any error that isn't -EJUKEBOX.

Thanks,

Ilya