Skip to contentSkip to conversation

ceph: fix double free for req when failing to allocate sparse ext map

PATCH In review [email protected] 3 participants 5 messages Jan 11, 2023 – Jan 13, 2023 Ceph client

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ceph: fix double free for req when failing to allocate sparse ext map

From: Xiubo Li <[email protected]>

Introduced by commit d1f436736924 ("ceph: add new mount option to enable sparse reads") and will fold this into the above commit since it's still in the testing branch.

---
 fs/ceph/addr.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
fs/ceph/addr.c +1 -3
index 17758cb607ec..3561c95d7e23 100644
@@ -351,10 +351,8 @@ static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq)
 
 	if (sparse) {
 		err = ceph_alloc_sparse_ext_map(&req->r_ops[0]);
-		if (err) {
-			ceph_osdc_put_request(req);
+		if (err)
 			goto out;
-		}
 	}
 
 	dout("%s: pos=%llu orig_len=%zu len=%llu\n", __func__, subreq->start, subreq->len, len);
Signature · 1 line
2.39.0
maintainer
#1 lore raw
Quoted 30 lines · On Wed, Jan 11, 2023 at 2:14 AM <[email protected]> wrote:

From: Xiubo Li <[email protected]>

Introduced by commit d1f436736924 ("ceph: add new mount option to enable sparse reads") and will fold this into the above commit since it's still in the testing branch.

---
 fs/ceph/addr.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
fs/ceph/addr.c +1 -4
index 17758cb607ec..3561c95d7e23 100644
@@ -351,10 +351,8 @@ static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq)
 
        if (sparse) {
                err = ceph_alloc_sparse_ext_map(&req->r_ops[0]);
-               if (err) {
-                       ceph_osdc_put_request(req);
+               if (err)
                        goto out;
-               }
        }
 
        dout("%s: pos=%llu orig_len=%zu len=%llu\n", __func__, subreq->start, subreq->len, len);
--
Quoted 2 lines

2.39.0

Hi Xiubo,

Looks good, let's fold this into that commit since it's still testing branch material.

Thanks,

Ilya

author
#2 lore raw
Quoted 28 lines · Ilya Dryomov
Quoted 27 lines · On Wed, Jan 11, 2023 at 2:14 AM <[email protected]> wrote:

From: Xiubo Li <[email protected]>

Introduced by commit d1f436736924 ("ceph: add new mount option to enable sparse reads") and will fold this into the above commit since it's still in the testing branch.

---
  fs/ceph/addr.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
fs/ceph/addr.c +1 -3
index 17758cb607ec..3561c95d7e23 100644
@@ -351,10 +351,8 @@ static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq)
 
         if (sparse) {
                 err = ceph_alloc_sparse_ext_map(&req->r_ops[0]);
-               if (err) {
-                       ceph_osdc_put_request(req);
+               if (err)
                         goto out;
-               }
         }
 
Quoted 8 lines
Quoted 4 lines
fs/ceph/addr.c +0 -1
         dout("%s: pos=%llu orig_len=%zu len=%llu\n", __func__, subreq->start, subreq->len, len);
--

2.39.0

Hi Xiubo,

Looks good, let's fold this into that commit since it's still testing branch material.

Yeah, sure will do.

Thanks

- Xiubo

Quoted 4 lines

Thanks,

Ilya

Signature · 6 lines
Best Regards,

Xiubo Li (李秀波)

Email: [email protected]/[email protected]
Slack: @Xiubo Li
Reviewed-by on v1 1/1
#3 lore raw
In reply to [email protected]
Quoted 18 lines · On Wed, 2023-01-11 at 09:14 +0800, [email protected] wrote:

From: Xiubo Li <[email protected]>

Introduced by commit d1f436736924 ("ceph: add new mount option to enable sparse reads") and will fold this into the above commit since it's still in the testing branch.

---
 fs/ceph/addr.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
fs/ceph/addr.c +0 -0
index 17758cb607ec..3561c95d7e23 100644
@@ -351,10 +351,8 @@ static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq)
 

fs/ceph/addr.c static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq) · line 358

Quoted 10 lines
fs/ceph/addr.c +1 -3
 	if (sparse) {
 		err = ceph_alloc_sparse_ext_map(&req->r_ops[0]);
-		if (err) {
-			ceph_osdc_put_request(req);
+		if (err)
 			goto out;
-		}
 	}
 
 	dout("%s: pos=%llu orig_len=%zu len=%llu\n", __func__, subreq->start, subreq->len, len);

Looks right.

author
#4 lore raw
Quoted 28 lines · Jeff Layton
Quoted 27 lines · On Wed, 2023-01-11 at 09:14 +0800, [email protected] wrote:

From: Xiubo Li <[email protected]>

Introduced by commit d1f436736924 ("ceph: add new mount option to enable sparse reads") and will fold this into the above commit since it's still in the testing branch.

---
  fs/ceph/addr.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
fs/ceph/addr.c +1 -3
index 17758cb607ec..3561c95d7e23 100644
@@ -351,10 +351,8 @@ static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq)
 
  	if (sparse) {
  		err = ceph_alloc_sparse_ext_map(&req->r_ops[0]);
-		if (err) {
-			ceph_osdc_put_request(req);
+		if (err)
  			goto out;
-		}
  	}
 
Quoted 4 lines

fs/ceph/addr.c static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq) · line 358

Quoted 1 line
fs/ceph/addr.c +0 -0
  	dout("%s: pos=%llu orig_len=%zu len=%llu\n", __func__, subreq->start, subreq->len, len);

Looks right.

Already folded this into the previous commit.

Thanks Jeff.

Signature · 6 lines
Best Regards,

Xiubo Li (李秀波)

Email: [email protected]/[email protected]
Slack: @Xiubo Li