lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211103112405.8733-2-lhenriques@suse.de>
Date:   Wed,  3 Nov 2021 11:24:04 +0000
From:   Luís Henriques <lhenriques@...e.de>
To:     Jeff Layton <jlayton@...nel.org>,
        Ilya Dryomov <idryomov@...il.com>, Xiubo Li <xiubli@...hat.com>
Cc:     Patrick Donnelly <pdonnell@...hat.com>, ceph-devel@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Luís Henriques <lhenriques@...e.de>
Subject: [PATCH 1/2] libceph: have ceph_osdc_copy_from() return the osd request

This patch modifies the behaviour of ceph_osdc_copy_from() function so
that it will create the osd request and send it but won't block waiting
for the result.  It is now the responsibility of the callers (currently
only ceph_do_objects_copy()) to do the wait and release the request.

Signed-off-by: Luís Henriques <lhenriques@...e.de>
---
 fs/ceph/file.c                  |  9 ++++++++-
 include/linux/ceph/osd_client.h | 21 +++++++++++----------
 net/ceph/osd_client.c           | 27 ++++++++++++++-------------
 3 files changed, 33 insertions(+), 24 deletions(-)

diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 6005b430f6f7..a39703b8ef99 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -2218,6 +2218,7 @@ static ssize_t ceph_do_objects_copy(struct ceph_inode_info *src_ci, u64 *src_off
 {
 	struct ceph_object_locator src_oloc, dst_oloc;
 	struct ceph_object_id src_oid, dst_oid;
+	struct ceph_osd_request *req;
 	size_t bytes = 0;
 	u64 src_objnum, src_objoff, dst_objnum, dst_objoff;
 	u32 src_objlen, dst_objlen;
@@ -2243,7 +2244,7 @@ static ssize_t ceph_do_objects_copy(struct ceph_inode_info *src_ci, u64 *src_off
 		ceph_oid_printf(&dst_oid, "%llx.%08llx",
 				dst_ci->i_vino.ino, dst_objnum);
 		/* Do an object remote copy */
-		ret = ceph_osdc_copy_from(&fsc->client->osdc,
+		req = ceph_osdc_copy_from(&fsc->client->osdc,
 					  src_ci->i_vino.snap, 0,
 					  &src_oid, &src_oloc,
 					  CEPH_OSD_OP_FLAG_FADVISE_SEQUENTIAL |
@@ -2254,6 +2255,12 @@ static ssize_t ceph_do_objects_copy(struct ceph_inode_info *src_ci, u64 *src_off
 					  dst_ci->i_truncate_seq,
 					  dst_ci->i_truncate_size,
 					  CEPH_OSD_COPY_FROM_FLAG_TRUNCATE_SEQ);
+		if (IS_ERR(req))
+			ret = PTR_ERR(req);
+		else {
+			ret = ceph_osdc_wait_request(&fsc->client->osdc, req);
+			ceph_osdc_put_request(req);
+		}
 		if (ret) {
 			if (ret == -EOPNOTSUPP) {
 				fsc->have_copy_from2 = false;
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index 83fa08a06507..74d590cd29c9 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -515,16 +515,17 @@ int ceph_osdc_call(struct ceph_osd_client *osdc,
 		   struct page *req_page, size_t req_len,
 		   struct page **resp_pages, size_t *resp_len);
 
-int ceph_osdc_copy_from(struct ceph_osd_client *osdc,
-			u64 src_snapid, u64 src_version,
-			struct ceph_object_id *src_oid,
-			struct ceph_object_locator *src_oloc,
-			u32 src_fadvise_flags,
-			struct ceph_object_id *dst_oid,
-			struct ceph_object_locator *dst_oloc,
-			u32 dst_fadvise_flags,
-			u32 truncate_seq, u64 truncate_size,
-			u8 copy_from_flags);
+struct ceph_osd_request *
+ceph_osdc_copy_from(struct ceph_osd_client *osdc,
+		    u64 src_snapid, u64 src_version,
+		    struct ceph_object_id *src_oid,
+		    struct ceph_object_locator *src_oloc,
+		    u32 src_fadvise_flags,
+		    struct ceph_object_id *dst_oid,
+		    struct ceph_object_locator *dst_oloc,
+		    u32 dst_fadvise_flags,
+		    u32 truncate_seq, u64 truncate_size,
+		    u8 copy_from_flags);
 
 /* watch/notify */
 struct ceph_osd_linger_request *
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index ff8624a7c964..78384b431748 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -5347,23 +5347,24 @@ static int osd_req_op_copy_from_init(struct ceph_osd_request *req,
 	return 0;
 }
 
-int ceph_osdc_copy_from(struct ceph_osd_client *osdc,
-			u64 src_snapid, u64 src_version,
-			struct ceph_object_id *src_oid,
-			struct ceph_object_locator *src_oloc,
-			u32 src_fadvise_flags,
-			struct ceph_object_id *dst_oid,
-			struct ceph_object_locator *dst_oloc,
-			u32 dst_fadvise_flags,
-			u32 truncate_seq, u64 truncate_size,
-			u8 copy_from_flags)
+struct ceph_osd_request *
+ceph_osdc_copy_from(struct ceph_osd_client *osdc,
+		    u64 src_snapid, u64 src_version,
+		    struct ceph_object_id *src_oid,
+		    struct ceph_object_locator *src_oloc,
+		    u32 src_fadvise_flags,
+		    struct ceph_object_id *dst_oid,
+		    struct ceph_object_locator *dst_oloc,
+		    u32 dst_fadvise_flags,
+		    u32 truncate_seq, u64 truncate_size,
+		    u8 copy_from_flags)
 {
 	struct ceph_osd_request *req;
 	int ret;
 
 	req = ceph_osdc_alloc_request(osdc, NULL, 1, false, GFP_KERNEL);
 	if (!req)
-		return -ENOMEM;
+		return ERR_PTR(-ENOMEM);
 
 	req->r_flags = CEPH_OSD_FLAG_WRITE;
 
@@ -5382,11 +5383,11 @@ int ceph_osdc_copy_from(struct ceph_osd_client *osdc,
 		goto out;
 
 	ceph_osdc_start_request(osdc, req, false);
-	ret = ceph_osdc_wait_request(osdc, req);
+	return req;
 
 out:
 	ceph_osdc_put_request(req);
-	return ret;
+	return ERR_PTR(ret);
 }
 EXPORT_SYMBOL(ceph_osdc_copy_from);
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ