lustre-devel-lustre.org archive mirror
 help / color / mirror / Atom feed
* [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023
@ 2025-02-02 20:46 James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 01/33] lnet: set msg field for lnet message header James Simmons
                   ` (32 more replies)
  0 siblings, 33 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown; +Cc: Lustre Development List

Port the work done during the month of May on the OpenSFS tree
to the native client. Also synced the interval tree work
between both branches.

Andreas Dilger (2):
  lustre: uapi: cleanup FSFILT defines
  lustre: misc: replace obsolete ioctl numbers

Arshad Hussain (2):
  lnet: libcfs: Remove unsed LASSERT_ATOMIC_* macros
  lnet: libcfs: Remove reference to LASSERT_ATOMIC_POS

Bobi Jam (1):
  lustre: csdc: reserve layout bits for compress component

Chris Horn (2):
  lnet: Use dynamic allocation for LND tunables
  lnet: improve numeric NID to CPT hashing

James Simmons (6):
  lnet: set msg field for lnet message header
  lustre: obd: change lmd flags to bitmap
  lustre: obd: replace simple_strtoul()
  lnet: collect data about routes by using Netlink
  lnet: libcfs: use round_up directly
  lnet: ksocklnd: ksocklnd_ni_get_eth_intf_speed() must use only rtnl lock

Lai Siyao (1):
  lustre: lmv: treat unknown hash type as sane type

Li Dongyang (2):
  lustre: cksum: fix generating T10PI guard tags for partial brw page
  lustre: mdc: md_open_data should keep ref on close_req

Li Xi (1):
  lustre: llite: update comment of ll_swap_layouts_close

Mr NeilBrown (5):
  lnet: selftest: manage the workqueue state properly
  lustre: ptlrpc: switch sptlrpc_rule_set_choose to large nid
  lnet: use list_first_entry() where appropriate.
  lnet: libcfs: move cfs_expr_list_print to nidstrings.c
  lustre: ldlm: convert ldlm extent locks to linux extent-tree

Patrick Farrell (4):
  Revert "lustre: llite: Check vmpage in releasepage"
  lustre: llite: EIO is possible on a race with page reclaim
  lustre: obd: Reserve metadata overstriping flags
  lustre: llite: Fix return for non-queued aio

Qian Yingjin (2):
  lustre: llite: add __GFP_NORETRY for read-ahead page
  lustre: statahead: using try lock for batched RPCs

Timothy Day (4):
  lustre: llite: remove OBD_ -> CFS_ macros
  lustre: obd: remove OBD_ -> CFS_ macros
  lustre: ldlm: replace OBD_ -> CFS_ macros
  lustre: mdc: remove OBD_ -> CFS_ macros

Wang Shilong (1):
  lustre: remove cl_{offset,index,page_size} helpers

 fs/lustre/include/cl_object.h              |  13 +-
 fs/lustre/include/lustre_disk.h            |  51 ++-
 fs/lustre/include/lustre_dlm.h             |  22 +-
 fs/lustre/include/lustre_ioctl_old.h       |  85 ++++
 fs/lustre/include/lustre_lmv.h             |   4 +-
 fs/lustre/include/obd.h                    |  13 +-
 fs/lustre/include/obd_class.h              |   4 +-
 fs/lustre/include/obd_support.h            |   1 +
 fs/lustre/ldlm/ldlm_extent.c               |  49 ++-
 fs/lustre/ldlm/ldlm_flock.c                |  16 +-
 fs/lustre/ldlm/ldlm_lib.c                  |   4 +-
 fs/lustre/ldlm/ldlm_lock.c                 |  55 ++-
 fs/lustre/ldlm/ldlm_lockd.c                |  23 +-
 fs/lustre/ldlm/ldlm_request.c              |   8 +-
 fs/lustre/ldlm/ldlm_resource.c             |   2 +-
 fs/lustre/llite/dir.c                      |   2 +-
 fs/lustre/llite/file.c                     | 130 ++----
 fs/lustre/llite/glimpse.c                  |   2 +-
 fs/lustre/llite/llite_internal.h           |   4 +-
 fs/lustre/llite/llite_lib.c                |  27 +-
 fs/lustre/llite/llite_mmap.c               |   4 +-
 fs/lustre/llite/namei.c                    |   6 +-
 fs/lustre/llite/pcc.c                      |   8 +-
 fs/lustre/llite/rw.c                       |  31 +-
 fs/lustre/llite/rw26.c                     |  28 +-
 fs/lustre/llite/vvp_io.c                   |  53 ++-
 fs/lustre/llite/vvp_object.c               |   4 +-
 fs/lustre/llite/xattr_cache.c              |   2 +-
 fs/lustre/lmv/lmv_obd.c                    |   5 +-
 fs/lustre/lov/lov_io.c                     |  19 +-
 fs/lustre/lov/lov_lock.c                   |   8 +-
 fs/lustre/lov/lov_obd.c                    |   3 +-
 fs/lustre/lov/lov_object.c                 |   2 +-
 fs/lustre/lov/lov_page.c                   |  16 +-
 fs/lustre/mdc/mdc_dev.c                    |  12 +-
 fs/lustre/mdc/mdc_locks.c                  |   4 +-
 fs/lustre/mdc/mdc_request.c                |  23 +-
 fs/lustre/mgc/mgc_request.c                |   4 +-
 fs/lustre/obdclass/cl_page.c               |  26 +-
 fs/lustre/obdclass/class_obd.c             |  24 +-
 fs/lustre/obdclass/kernelcomm.c            |   2 +-
 fs/lustre/obdclass/llog_obd.c              |   2 +-
 fs/lustre/obdclass/lu_object.c             |   4 +-
 fs/lustre/obdclass/obd_config.c            |   2 +-
 fs/lustre/obdclass/obd_mount.c             |  64 ++-
 fs/lustre/obdecho/echo_client.c            |   2 +-
 fs/lustre/osc/osc_cache.c                  |  27 +-
 fs/lustre/osc/osc_io.c                     |  28 +-
 fs/lustre/osc/osc_lock.c                   |  20 +-
 fs/lustre/osc/osc_page.c                   |  15 +-
 fs/lustre/osc/osc_request.c                |  52 ++-
 fs/lustre/ptlrpc/batch.c                   |   6 +-
 fs/lustre/ptlrpc/layout.c                  |   8 +-
 fs/lustre/ptlrpc/pack_generic.c            |  14 +-
 fs/lustre/ptlrpc/sec.c                     |  16 +-
 fs/lustre/ptlrpc/sec_config.c              |  10 +-
 fs/lustre/ptlrpc/wiretest.c                |  14 +-
 include/linux/libcfs/libcfs_private.h      |  49 ---
 include/linux/libcfs/libcfs_string.h       |   2 -
 include/linux/lnet/lib-lnet.h              |   4 +
 include/linux/lnet/lib-types.h             |  40 ++
 include/uapi/linux/lnet/libcfs_ioctl.h     |   7 +-
 include/uapi/linux/lnet/lnet-dlc.h         |   7 +-
 include/uapi/linux/lustre/lustre_ioctl.h   |  47 +--
 include/uapi/linux/lustre/lustre_user.h    |  49 ++-
 net/lnet/klnds/o2iblnd/o2iblnd.h           |   2 +-
 net/lnet/klnds/socklnd/socklnd_modparams.c |   4 +-
 net/lnet/libcfs/libcfs_string.c            |  68 ----
 net/lnet/libcfs/module.c                   |   8 +-
 net/lnet/lnet/api-ni.c                     | 453 ++++++++++++++++++++-
 net/lnet/lnet/lib-move.c                   |   4 +-
 net/lnet/lnet/nidstrings.c                 |  68 ++++
 net/lnet/selftest/framework.c              |  29 +-
 net/lnet/selftest/module.c                 |  15 +-
 net/lnet/selftest/rpc.c                    |  31 +-
 net/lnet/selftest/selftest.h               |  27 +-
 76 files changed, 1256 insertions(+), 741 deletions(-)
 create mode 100644 fs/lustre/include/lustre_ioctl_old.h

-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 01/33] lnet: set msg field for lnet message header
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 02/33] Revert "lustre: llite: Check vmpage in releasepage" James Simmons
                   ` (31 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Frank Sehr, Serguei Smirnov, Lustre Development List

During testing messages sent for larger NID setups was missing
the actual message. Fill in the header msg field to properly
send the total message.

Fixes: 2c91699fb0b ("lnet: socklnd: add hello message version 4")
WC-bug-id: https://jira.whamcloud.com/browse/LU-10391
Lustre-commit: 562865630e67afb06 ("LU-10391 lnet: set msg field for lnet message header")
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50716
Reviewed-by: Frank Sehr <fsehr@whamcloud.com>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
---
 include/linux/lnet/lib-lnet.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/linux/lnet/lib-lnet.h b/include/linux/lnet/lib-lnet.h
index 4aa1e5c91948..84bb3f2966a7 100644
--- a/include/linux/lnet/lib-lnet.h
+++ b/include/linux/lnet/lib-lnet.h
@@ -519,6 +519,8 @@ static inline void lnet_hdr_from_nid16(struct lnet_hdr *hdr,
 	hdr->src_pid = le32_to_cpu(hdr16->src_pid);
 	hdr->type = le32_to_cpu(hdr16->type);
 	hdr->payload_length = le32_to_cpu(hdr16->payload_length);
+
+	hdr->msg = hdr16->msg;
 }
 
 static inline void lnet_hdr_to_nid16(const struct lnet_hdr *hdr,
@@ -532,6 +534,8 @@ static inline void lnet_hdr_to_nid16(const struct lnet_hdr *hdr,
 	hdr16->src_pid = cpu_to_le32(hdr->src_pid);
 	hdr16->type = cpu_to_le32(hdr->type);
 	hdr16->payload_length = cpu_to_le32(hdr->payload_length);
+
+	hdr16->msg = hdr->msg;
 }
 
 extern struct lnet_lnd the_lolnd;
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 02/33] Revert "lustre: llite: Check vmpage in releasepage"
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 01/33] lnet: set msg field for lnet message header James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 03/33] lustre: llite: EIO is possible on a race with page reclaim James Simmons
                   ` (30 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Andrew Perepechko, Lustre Development List

From: Patrick Farrell <pfarrell@whamcloud.com>

This reverts commit 9c78efe1a483968c6f84092cb6e59a3f64bc13d6,
because it breaks releasepage for Lustre and does not
completely fix the data consistency issue in LU-14541.

Breaking releasepage matters because it prevents direct I/O
from working if there is page cache data present, and
because it causes similar issues with GDS, which must be
able to flush page cache pages before doing I/O.

With patches:
commit e02cfe39f908 ("lustre: llite: SIGBUS is possible on a race with page reclaim")
and
commit 6af2199c4868 ("lustre: llite: Check for page deletion after fault")
LU-14541 is fully resolved, so we can revert this patch.

WC-bug-id: https://jira.whamcloud.com/browse/LU-14541
Lustre-commit: e3cfb688ed7116a57 ("Revert "lustre: llite: Check vmpage in releasepage")
Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49654
Reviewed-by: Andrew Perepechko <andrew.perepechko@hpe.com>
Reviewed-by: Qian Yingjin <qian@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/include/cl_object.h |  9 ---------
 fs/lustre/llite/rw26.c        | 19 ++++++-------------
 fs/lustre/osc/osc_page.c      |  9 ++-------
 3 files changed, 8 insertions(+), 29 deletions(-)

diff --git a/fs/lustre/include/cl_object.h b/fs/lustre/include/cl_object.h
index 77f00d7fc220..94e7f8060d4a 100644
--- a/fs/lustre/include/cl_object.h
+++ b/fs/lustre/include/cl_object.h
@@ -91,7 +91,6 @@
 #include <linux/uio.h>
 #include <lu_object.h>
 #include <linux/atomic.h>
-#include <linux/mm.h>
 #include <linux/mutex.h>
 #include <linux/radix-tree.h>
 #include <linux/spinlock.h>
@@ -989,14 +988,6 @@ static inline bool __page_in_use(const struct cl_page *page, int refc)
  */
 #define cl_page_in_use_noref(pg) __page_in_use(pg, 0)
 
-/* references: cl_page, page cache, optional + refcount for caller reference
- * (always 0 or 1 currently)
- */
-static inline int vmpage_in_use(struct page *vmpage, int refcount)
-{
-	return (page_count(vmpage) - page_mapcount(vmpage) > 2 + refcount);
-}
-
 /** @} cl_page */
 
 /** \addtogroup cl_lock cl_lock
diff --git a/fs/lustre/llite/rw26.c b/fs/lustre/llite/rw26.c
index 6b338b20e7d5..2065e14e8469 100644
--- a/fs/lustre/llite/rw26.c
+++ b/fs/lustre/llite/rw26.c
@@ -109,7 +109,7 @@ static int ll_releasepage(struct page *vmpage, gfp_t gfp_mask)
 {
 	struct lu_env *env;
 	struct cl_object *obj;
-	struct cl_page *clpage;
+	struct cl_page *page;
 	struct address_space *mapping;
 	int result = 0;
 
@@ -125,23 +125,16 @@ static int ll_releasepage(struct page *vmpage, gfp_t gfp_mask)
 	if (!obj)
 		return 1;
 
-	clpage = cl_vmpage_page(vmpage, obj);
-	if (!clpage)
+	page = cl_vmpage_page(vmpage, obj);
+	if (!page)
 		return 1;
 
 	env = cl_env_percpu_get();
 	LASSERT(!IS_ERR(env));
 
-	/* we must not delete the cl_page if the vmpage is in use, otherwise we
-	 * disconnect the vmpage from Lustre while it's still alive(!), which
-	 * means we won't find it to discard on lock cancellation.
-	 *
-	 * References here are: caller + cl_page + page cache.
-	 * Any other references are potentially transient and must be ignored.
-	 */
-	if (!cl_page_in_use(clpage) && !vmpage_in_use(vmpage, 1)) {
+	if (!cl_page_in_use(page)) {
 		result = 1;
-		cl_page_delete(env, clpage);
+		cl_page_delete(env, page);
 	}
 
 	/* To use percpu env array, the call path can not be rescheduled;
@@ -158,7 +151,7 @@ static int ll_releasepage(struct page *vmpage, gfp_t gfp_mask)
 	 * that we won't get into object delete path.
 	 */
 	LASSERT(cl_object_refc(obj) > 1);
-	cl_page_put(env, clpage);
+	cl_page_put(env, page);
 
 	cl_env_percpu_put(env);
 	return result;
diff --git a/fs/lustre/osc/osc_page.c b/fs/lustre/osc/osc_page.c
index feec99fe0ca2..f700b5af7de0 100644
--- a/fs/lustre/osc/osc_page.c
+++ b/fs/lustre/osc/osc_page.c
@@ -520,13 +520,8 @@ static inline bool lru_page_busy(struct client_obd *cli, struct cl_page *page)
 	if (cli->cl_cache->ccc_unstable_check) {
 		struct page *vmpage = cl_page_vmpage(page);
 
-		/* this check is racy because the vmpage is not locked, but
-		 * that's OK - the code which does the actual page release
-		 * checks this again before releasing
-		 *
-		 * vmpage have two known users: cl_page and VM page cache
-		 */
-		if (vmpage_in_use(vmpage, 0))
+		/* vmpage have two known users: cl_page and VM page cache */
+		if (page_count(vmpage) - page_mapcount(vmpage) > 2)
 			return true;
 	}
 	return false;
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 03/33] lustre: llite: EIO is possible on a race with page reclaim
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 01/33] lnet: set msg field for lnet message header James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 02/33] Revert "lustre: llite: Check vmpage in releasepage" James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 04/33] lustre: llite: add __GFP_NORETRY for read-ahead page James Simmons
                   ` (29 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Andrew Perepechko, Alexander Zarochentsev,
	Lustre Development List

From: Patrick Farrell <pfarrell@whamcloud.com>

We must clear the 'uptodate' page flag when we delete a
page from Lustre, or stale reads can occur.  However,
generic_file_buffered_read requires any pages returned from
readpage() be uptodate.

So, we must retry reading if page truncation happens in
parallel with the read.

This implements the same fix as:
https://review.whamcloud.com/49647
commit e02cfe39f908 ("lustre: llite: SIGBUS is possible on a race with page reclaim")

did for the mmap path.

WC-bug-id: https://jira.whamcloud.com/browse/LU-16649
Lustre-commit: 1d98e5c32b41e19bb ("LU-16649 llite: EIO is possible on a race with page reclaim")
Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50344
Reviewed-by: Andrew Perepechko <andrew.perepechko@hpe.com>
Reviewed-by: Qian Yingjin <qian@ddn.com>
Reviewed-by: Alexander Zarochentsev <alexander.zarochentsev@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/include/obd_support.h |  1 +
 fs/lustre/llite/file.c          | 11 +++++++----
 fs/lustre/llite/rw.c            |  8 ++++++++
 fs/lustre/llite/vvp_io.c        | 25 ++++++++++++++++++++++---
 4 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/fs/lustre/include/obd_support.h b/fs/lustre/include/obd_support.h
index cee7e3164d66..0a63af11db35 100644
--- a/fs/lustre/include/obd_support.h
+++ b/fs/lustre/include/obd_support.h
@@ -492,6 +492,7 @@ extern char obd_jobid_var[];
 #define OBD_FAIL_LLITE_PAGE_INVALIDATE_PAUSE		0x1421
 #define OBD_FAIL_LLITE_READPAGE_PAUSE			0x1422
 #define OBD_FAIL_LLITE_PANIC_ON_ESTALE			0x1423
+#define OBD_FAIL_LLITE_READPAGE_PAUSE2			0x1424
 
 #define OBD_FAIL_FID_INDIR				0x1501
 #define OBD_FAIL_FID_INLMA				0x1502
diff --git a/fs/lustre/llite/file.c b/fs/lustre/llite/file.c
index c99e9c01bc65..b2751b571ea9 100644
--- a/fs/lustre/llite/file.c
+++ b/fs/lustre/llite/file.c
@@ -1990,12 +1990,15 @@ ll_do_fast_read(struct kiocb *iocb, struct iov_iter *iter)
 
 	result = generic_file_read_iter(iocb, iter);
 
-	/*
-	 * If the first page is not in cache, generic_file_aio_read() will be
-	 * returned with -ENODATA.
+	/* If the first page is not in cache, generic_file_aio_read() will be
+	 * returned with -ENODATA.  Fall back to full read path.
 	 * See corresponding code in ll_readpage().
+	 *
+	 * if we raced with page deletion, we might get EIO.  Rather than add
+	 * locking to the fast path for this rare case, fall back to the full
+	 * read path.  (See vvp_io_read_start() for rest of handling.
 	 */
-	if (result == -ENODATA)
+	if (result == -ENODATA || result == -EIO)
 		result = 0;
 
 	if (result > 0) {
diff --git a/fs/lustre/llite/rw.c b/fs/lustre/llite/rw.c
index 0c73258428e6..92a9c252247e 100644
--- a/fs/lustre/llite/rw.c
+++ b/fs/lustre/llite/rw.c
@@ -2046,5 +2046,13 @@ int ll_readpage(struct file *file, struct page *vmpage)
 	if (ra.cra_release)
 		cl_read_ahead_release(env, &ra);
 
+	/* this delay gives time for the actual read of the page to finish and
+	 * unlock the page in vvp_page_completion_read before we return to our
+	 * caller and the caller tries to use the page, allowing us to test
+	 * races with the page being unlocked after readpage() but before it's
+	 * used by the caller
+	 */
+	OBD_FAIL_TIMEOUT(OBD_FAIL_LLITE_READPAGE_PAUSE2, cfs_fail_val);
+
 	return result;
 }
diff --git a/fs/lustre/llite/vvp_io.c b/fs/lustre/llite/vvp_io.c
index 26dfaaa76bd9..86dab3b1a39f 100644
--- a/fs/lustre/llite/vvp_io.c
+++ b/fs/lustre/llite/vvp_io.c
@@ -811,8 +811,10 @@ static int vvp_io_read_start(const struct lu_env *env,
 	size_t cnt = io->u.ci_rd.rd.crw_count;
 	size_t tot = vio->vui_tot_count;
 	struct ll_cl_context *lcc;
+	unsigned int seq;
 	int exceed = 0;
 	int result;
+	int total_bytes_read = 0;
 	struct iov_iter iter;
 	pgoff_t page_offset;
 
@@ -878,12 +880,29 @@ static int vvp_io_read_start(const struct lu_env *env,
 	lcc->lcc_end_index = DIV_ROUND_UP(pos + iter.count, PAGE_SIZE);
 	CDEBUG(D_VFSTRACE, "count:%ld iocb pos:%lld\n", iter.count, pos);
 
-	result = generic_file_read_iter(vio->vui_iocb, &iter);
+	/* this seqlock lets us notice if a page has been deleted on this inode
+	 * during the fault process, allowing us to catch an erroneous short
+	 * read or EIO
+	 * See LU-16160
+	 */
+	do {
+		seq = read_seqbegin(&ll_i2info(inode)->lli_page_inv_lock);
+		result = generic_file_read_iter(vio->vui_iocb, &iter);
+		if (result >= 0) {
+			io->ci_nob += result;
+			total_bytes_read += result;
+		}
+	/* if we got a short read or -EIO and we raced with page invalidation,
+	 * retry
+	 */
+	} while (read_seqretry(&ll_i2info(inode)->lli_page_inv_lock, seq) &&
+		 ((result >= 0 && iov_iter_count(&iter) > 0) ||
+		  result == -EIO));
+
 out:
 	if (result >= 0) {
-		if (result < cnt)
+		if (total_bytes_read < cnt)
 			io->ci_continue = 0;
-		io->ci_nob += result;
 		result = 0;
 	} else if (result == -EIOCBQUEUED) {
 		io->ci_nob += vio->u.readwrite.vui_read;
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 04/33] lustre: llite: add __GFP_NORETRY for read-ahead page
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (2 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 03/33] lustre: llite: EIO is possible on a race with page reclaim James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 05/33] lustre: obd: change lmd flags to bitmap James Simmons
                   ` (28 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown; +Cc: Lustre Development List

From: Qian Yingjin <qian@ddn.com>

We need __GFP_NORETRY for read-ahead page, otherwise the read
process would be OOM killed when reached cgroup memory limits.

WC-bug-id: https://jira.whamcloud.com/browse/LU-16713
Lustre-commit: 8db5d39f669f03aa6 ("LU-16713 llite: add __GFP_NORETRY for read-ahead page")
Signed-off-by: Qian Yingjin <qian@ddn.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50625
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/llite/rw.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/fs/lustre/llite/rw.c b/fs/lustre/llite/rw.c
index 92a9c252247e..9b1cf71116df 100644
--- a/fs/lustre/llite/rw.c
+++ b/fs/lustre/llite/rw.c
@@ -210,7 +210,16 @@ static int ll_read_ahead_page(const struct lu_env *env, struct cl_io *io,
 
 	switch (hint) {
 	case MAYNEED:
-		vmpage = grab_cache_page_nowait(inode->i_mapping, index);
+		/*
+		 * We need __GFP_NORETRY here for read-ahead page, otherwise
+		 * the process will fail with OOM killed due to memcg limit.
+		 * See @readahead_gfp_mask for an example.
+		 */
+		vmpage = pagecache_get_page(inode->i_mapping, index,
+					    FGP_LOCK | FGP_CREAT |
+					    FGP_NOFS | FGP_NOWAIT,
+					    mapping_gfp_mask(inode->i_mapping) |
+					    __GFP_NORETRY | __GFP_NOWARN);
 		if (!vmpage) {
 			which = RA_STAT_FAILED_GRAB_PAGE;
 			msg = "g_c_p_n failed";
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 05/33] lustre: obd: change lmd flags to bitmap
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (3 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 04/33] lustre: llite: add __GFP_NORETRY for read-ahead page James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 06/33] lustre: uapi: cleanup FSFILT defines James Simmons
                   ` (27 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown; +Cc: Lustre Development List

Change lmd flags to an enum that is accessible with the Linux
bitmap API. This lays the foundation for creating a match table
for the server options for mounting.

WC-bug-id: https://jira.whamcloud.com/browse/LU-6142
Lustre-commit: a342697e580ffea62 ("LU-6142 obd: change lmd flags to bitmap")
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49912
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
---
 fs/lustre/include/lustre_disk.h | 51 +++++++++++++++-----------
 fs/lustre/mgc/mgc_request.c     |  2 +-
 fs/lustre/obdclass/obd_mount.c  | 64 +++++++++++++++++++++------------
 3 files changed, 73 insertions(+), 44 deletions(-)

diff --git a/fs/lustre/include/lustre_disk.h b/fs/lustre/include/lustre_disk.h
index a8e935eaeefa..976c0bb749c1 100644
--- a/fs/lustre/include/lustre_disk.h
+++ b/fs/lustre/include/lustre_disk.h
@@ -68,10 +68,38 @@
 #define LMD_MAGIC		0xbdacbd03
 #define LMD_PARAMS_MAXLEN	4096
 
+enum lmd_flags {
+	LMD_FLG_SERVER		= 0,	/* Mounting a server */
+	LMD_FLG_CLIENT,			/* Mounting a client */
+	LMD_FLG_SKIP_LFSCK,		/* NOT auto resume LFSCK when mount */
+	LMD_FLG_ABORT_RECOV,		/* Abort recovery */
+	LMD_FLG_NOSVC,			/* Only start MGS/MGC for servers,
+					 * no other services
+					 */
+	LMD_FLG_NOMGS,			/* Only start target for servers,
+					 * reusing existing MGS services
+					 */
+	LMD_FLG_WRITECONF,		/* Rewrite config log */
+	LMD_FLG_NOIR,			/* NO imperative recovery */
+	LMD_FLG_NOSCRUB,			/* Do not trigger scrub automatically */
+	LMD_FLG_MGS,			/* Also start MGS along with server */
+	LMD_FLG_IAM,			/* IAM dir */
+	LMD_FLG_NO_PRIMNODE,		/* all nodes are service nodes */
+	LMD_FLG_VIRGIN,			/* the service registers first time */
+	LMD_FLG_UPDATE,			/* update parameters */
+	LMD_FLG_HSM,			/* Start coordinator */
+	LMD_FLG_DEV_RDONLY,		/* discard modification quitely */
+	LMD_FLG_NO_PRECREATE,		/* do not allow OST object creation */
+	LMD_FLG_LOCAL_RECOV,		/* force recovery for local clients */
+	LMD_FLG_ABORT_RECOV_MDT,	/* Abort recovery between MDTs */
+	LMD_FLG_NO_LOCAL_LOGS,		/* Use config logs from MGS */
+	LMD_FLG_NUM_FLAGS
+};
+
 /* gleaned from the mount command - no persistent info here */
 struct lustre_mount_data {
 	u32	lmd_magic;
-	u32	lmd_flags;	/* lustre mount flags */
+	DECLARE_BITMAP(lmd_flags, LMD_FLG_NUM_FLAGS); /* lustre mount flags */
 	int	lmd_mgs_failnodes; /* mgs failover node count */
 	int	lmd_exclude_count;
 	int	lmd_recovery_time_soft;
@@ -90,26 +118,7 @@ struct lustre_mount_data {
 	char    *lmd_nidnet;	/* network to restrict this client to */
 };
 
-#define LMD_FLG_SERVER		0x0001	/* Mounting a server */
-#define LMD_FLG_CLIENT		0x0002	/* Mounting a client */
-#define LMD_FLG_ABORT_RECOV	0x0008	/* Abort recovery */
-#define LMD_FLG_NOSVC		0x0010	/* Only start MGS/MGC for servers,
-					 * no other services
-					 */
-#define LMD_FLG_NOMGS		0x0020	/* Only start target for servers,
-					 * reusing existing MGS services
-					 */
-#define LMD_FLG_WRITECONF	0x0040	/* Rewrite config log */
-#define LMD_FLG_NOIR		0x0080	/* NO imperative recovery */
-#define LMD_FLG_NOSCRUB		0x0100	/* Do not trigger scrub automatically */
-#define LMD_FLG_MGS		0x0200	/* Also start MGS along with server */
-#define LMD_FLG_IAM		0x0400	/* IAM dir */
-#define LMD_FLG_NO_PRIMNODE	0x0800	/* all nodes are service nodes */
-#define LMD_FLG_VIRGIN		0x1000	/* the service registers first time */
-#define LMD_FLG_UPDATE		0x2000	/* update parameters */
-#define LMD_FLG_HSM		0x4000	/* Start coordinator */
-
-#define lmd_is_client(x) ((x)->lmd_flags & LMD_FLG_CLIENT)
+#define lmd_is_client(x) (test_bit(LMD_FLG_CLIENT, (x)->lmd_flags))
 
 /****************** superblock additional info *********************/
 
diff --git a/fs/lustre/mgc/mgc_request.c b/fs/lustre/mgc/mgc_request.c
index 62bf0eab512d..94e15f9e7c52 100644
--- a/fs/lustre/mgc/mgc_request.c
+++ b/fs/lustre/mgc/mgc_request.c
@@ -342,7 +342,7 @@ config_log_add(struct obd_device *obd, char *logname,
 	}
 
 	LASSERT(lsi->lsi_lmd);
-	if (!(lsi->lsi_lmd->lmd_flags & LMD_FLG_NOIR) &&
+	if (!test_bit(LMD_FLG_NOIR, lsi->lsi_lmd->lmd_flags) &&
 	    cfg->cfg_sub_clds & CONFIG_SUB_RECOVER) {
 		ptr = strrchr(seclogname, '-');
 		if (ptr) {
diff --git a/fs/lustre/obdclass/obd_mount.c b/fs/lustre/obdclass/obd_mount.c
index c569592bd6e7..02b7d88263c7 100644
--- a/fs/lustre/obdclass/obd_mount.c
+++ b/fs/lustre/obdclass/obd_mount.c
@@ -280,22 +280,25 @@ int lustre_start_mgc(struct super_block *sb)
 		if (lmd_is_client(lsi->lsi_lmd)) {
 			int has_ir;
 			int vallen = sizeof(*data);
-			u32 *flags = &lsi->lsi_lmd->lmd_flags;
 
 			rc = obd_get_info(NULL, obd->obd_self_export,
 					  strlen(KEY_CONN_DATA), KEY_CONN_DATA,
 					  &vallen, data);
 			LASSERT(rc == 0);
 			has_ir = OCD_HAS_FLAG(data, IMP_RECOV);
-			if (has_ir ^ !(*flags & LMD_FLG_NOIR)) {
+			if (has_ir ^ !test_bit(LMD_FLG_NOIR,
+					       lsi->lsi_lmd->lmd_flags)) {
 				/* LMD_FLG_NOIR is for test purpose only */
 				LCONSOLE_WARN(
 					"Trying to mount a client with IR setting not compatible with current mgc. Force to use current mgc setting that is IR %s.\n",
 					has_ir ? "enabled" : "disabled");
-				if (has_ir)
-					*flags &= ~LMD_FLG_NOIR;
-				else
-					*flags |= LMD_FLG_NOIR;
+				if (has_ir) {
+					clear_bit(LMD_FLG_NOIR,
+						  lsi->lsi_lmd->lmd_flags);
+				} else {
+					set_bit(LMD_FLG_NOIR,
+						lsi->lsi_lmd->lmd_flags);
+				}
 			}
 		}
 
@@ -408,7 +411,7 @@ int lustre_start_mgc(struct super_block *sb)
 	data->ocd_connect_flags2 = OBD_CONNECT2_REP_MBITS;
 
 	if (lmd_is_client(lsi->lsi_lmd) &&
-	    lsi->lsi_lmd->lmd_flags & LMD_FLG_NOIR)
+	    test_bit(LMD_FLG_NOIR, lsi->lsi_lmd->lmd_flags))
 		data->ocd_connect_flags &= ~OBD_CONNECT_IMP_RECOV;
 	data->ocd_version = LUSTRE_VERSION_CODE;
 	rc = obd_connect(NULL, &exp, obd, uuid, data, NULL);
@@ -695,7 +698,6 @@ static void lmd_print(struct lustre_mount_data *lmd)
 	if (lmd_is_client(lmd))
 		PRINT_CMD(D_MOUNT, "profile: %s\n", lmd->lmd_profile);
 	PRINT_CMD(D_MOUNT, "device:  %s\n", lmd->lmd_dev);
-	PRINT_CMD(D_MOUNT, "flags:   %x\n", lmd->lmd_flags);
 
 	if (lmd->lmd_opts)
 		PRINT_CMD(D_MOUNT, "options: %s\n", lmd->lmd_opts);
@@ -1053,8 +1055,12 @@ int lmd_parse(char *options, struct lustre_mount_data *lmd)
 		/* Parse non-ldiskfs options here. Rather than modifying
 		 * ldiskfs, we just zero these out here
 		 */
-		if (strncmp(s1, "abort_recov", 11) == 0) {
-			lmd->lmd_flags |= LMD_FLG_ABORT_RECOV;
+		if (!strncmp(s1, "abort_recov_mdt", 15) ||
+		    !strncmp(s1, "abort_recovery_mdt", 18)) {
+			set_bit(LMD_FLG_ABORT_RECOV_MDT, lmd->lmd_flags);
+			clear++;
+		} else if (strncmp(s1, "abort_recov", 11) == 0) {
+			set_bit(LMD_FLG_ABORT_RECOV, lmd->lmd_flags);
 			clear++;
 		} else if (strncmp(s1, "recovery_time_soft=", 19) == 0) {
 			lmd->lmd_recovery_time_soft = max_t(int,
@@ -1064,17 +1070,26 @@ int lmd_parse(char *options, struct lustre_mount_data *lmd)
 			lmd->lmd_recovery_time_hard = max_t(int,
 				simple_strtoul(s1 + 19, NULL, 10), time_min);
 			clear++;
-		} else if (strncmp(s1, "noir", 4) == 0) {
-			lmd->lmd_flags |= LMD_FLG_NOIR; /* test purpose only. */
+		} else if (strncmp(s1, "no_precreate", 12) == 0) {
+			set_bit(LMD_FLG_NO_PRECREATE, lmd->lmd_flags);
+			clear++;
+		} else if (strncmp(s1, "noir", 4) == 0) { /* test case only */
+			set_bit(LMD_FLG_NOIR, lmd->lmd_flags);
 			clear++;
 		} else if (strncmp(s1, "nosvc", 5) == 0) {
-			lmd->lmd_flags |= LMD_FLG_NOSVC;
+			set_bit(LMD_FLG_NOSVC, lmd->lmd_flags);
 			clear++;
 		} else if (strncmp(s1, "nomgs", 5) == 0) {
-			lmd->lmd_flags |= LMD_FLG_NOMGS;
+			set_bit(LMD_FLG_NOMGS, lmd->lmd_flags);
 			clear++;
 		} else if (strncmp(s1, "noscrub", 7) == 0) {
-			lmd->lmd_flags |= LMD_FLG_NOSCRUB;
+			set_bit(LMD_FLG_NOSCRUB, lmd->lmd_flags);
+			clear++;
+		} else if (strncmp(s1, "skip_lfsck", 10) == 0) {
+			set_bit(LMD_FLG_SKIP_LFSCK, lmd->lmd_flags);
+			clear++;
+		} else if (strncmp(s1, "rdonly_dev", 10) == 0) {
+			set_bit(LMD_FLG_DEV_RDONLY, lmd->lmd_flags);
 			clear++;
 		} else if (strncmp(s1, PARAM_MGSNODE,
 				   sizeof(PARAM_MGSNODE) - 1) == 0) {
@@ -1087,16 +1102,19 @@ int lmd_parse(char *options, struct lustre_mount_data *lmd)
 				goto invalid;
 			clear++;
 		} else if (strncmp(s1, "writeconf", 9) == 0) {
-			lmd->lmd_flags |= LMD_FLG_WRITECONF;
+			set_bit(LMD_FLG_WRITECONF, lmd->lmd_flags);
+			clear++;
+		} else if (strncmp(s1, "nolocallogs", 11) == 0) {
+			set_bit(LMD_FLG_NO_LOCAL_LOGS, lmd->lmd_flags);
 			clear++;
 		} else if (strncmp(s1, "update", 6) == 0) {
-			lmd->lmd_flags |= LMD_FLG_UPDATE;
+			set_bit(LMD_FLG_UPDATE, lmd->lmd_flags);
 			clear++;
 		} else if (strncmp(s1, "virgin", 6) == 0) {
-			lmd->lmd_flags |= LMD_FLG_VIRGIN;
+			set_bit(LMD_FLG_VIRGIN, lmd->lmd_flags);
 			clear++;
 		} else if (strncmp(s1, "noprimnode", 10) == 0) {
-			lmd->lmd_flags |= LMD_FLG_NO_PRIMNODE;
+			set_bit(LMD_FLG_NO_PRIMNODE, lmd->lmd_flags);
 			clear++;
 		} else if (strncmp(s1, "mgssec=", 7) == 0) {
 			rc = lmd_parse_mgssec(lmd, s1 + 7);
@@ -1112,7 +1130,7 @@ int lmd_parse(char *options, struct lustre_mount_data *lmd)
 			clear++;
 		} else if (strncmp(s1, "mgs", 3) == 0) {
 			/* We are an MGS */
-			lmd->lmd_flags |= LMD_FLG_MGS;
+			set_bit(LMD_FLG_MGS, lmd->lmd_flags);
 			clear++;
 		} else if (strncmp(s1, "svname=", 7) == 0) {
 			rc = lmd_parse_string(&lmd->lmd_profile, s1 + 7);
@@ -1143,6 +1161,9 @@ int lmd_parse(char *options, struct lustre_mount_data *lmd)
 			strlcat(lmd->lmd_params, " ", LMD_PARAMS_MAXLEN);
 			s3 = s1 + 6 + length;
 			clear++;
+		} else if (strncmp(s1, "localrecov", 10) == 0) {
+			set_bit(LMD_FLG_LOCAL_RECOV, lmd->lmd_flags);
+			clear++;
 		} else if (strncmp(s1, "osd=", 4) == 0) {
 			rc = lmd_parse_string(&lmd->lmd_osd_type, s1 + 4);
 			if (rc)
@@ -1196,7 +1217,7 @@ int lmd_parse(char *options, struct lustre_mount_data *lmd)
 	s1 = strstr(devname, ":/");
 	if (s1) {
 		++s1;
-		lmd->lmd_flags |= LMD_FLG_CLIENT;
+		set_bit(LMD_FLG_CLIENT, lmd->lmd_flags);
 		/* Remove leading /s from fsname */
 		while (*++s1 == '/')
 			;
@@ -1248,7 +1269,6 @@ int lmd_parse(char *options, struct lustre_mount_data *lmd)
 	}
 
 	lmd_print(lmd);
-	lmd->lmd_magic = LMD_MAGIC;
 
 	return rc;
 
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 06/33] lustre: uapi: cleanup FSFILT defines
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (4 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 05/33] lustre: obd: change lmd flags to bitmap James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 07/33] lustre: obd: Reserve metadata overstriping flags James Simmons
                   ` (26 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Alex Deiter, Li Dongyang, Lustre Development List

From: Andreas Dilger <adilger@whamcloud.com>

The various FSFILT_IOC_* defines are standard in Linux so remove
them from lustre_user.h. We do keep LL_IOC_GETVERSION to prevent
old tools breakage.

WC-bug-id: https://jira.whamcloud.com/browse/LU-137
Lustre-commit: ac0380dc519aa1531 ("LU-137 osd-ldiskfs: pass through resize ioctl")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/20161
Reviewed-by: Alex Deiter <alex.deiter@gmail.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/llite/llite_lib.c             |  2 +-
 include/uapi/linux/lustre/lustre_user.h | 10 ++--------
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/fs/lustre/llite/llite_lib.c b/fs/lustre/llite/llite_lib.c
index 37327be5be66..a9acce572e32 100644
--- a/fs/lustre/llite/llite_lib.c
+++ b/fs/lustre/llite/llite_lib.c
@@ -2877,7 +2877,7 @@ int ll_iocontrol(struct inode *inode, struct file *file,
 	case BLKSSZGET:
 		rc = put_user(PAGE_SIZE, (int __user *)uarg);
 		break;
-	case FSFILT_IOC_GETVERSION:
+	case LL_IOC_GETVERSION:
 	case FS_IOC_GETVERSION:
 		rc = put_user(inode->i_generation, (int __user *)uarg);
 		break;
diff --git a/include/uapi/linux/lustre/lustre_user.h b/include/uapi/linux/lustre/lustre_user.h
index 9c0632856bc8..0383db67361d 100644
--- a/include/uapi/linux/lustre/lustre_user.h
+++ b/include/uapi/linux/lustre/lustre_user.h
@@ -91,14 +91,8 @@ typedef struct stat	lstat_t;
 /* for statfs() */
 #define LL_SUPER_MAGIC 0x0BD00BD0
 
-#ifndef FSFILT_IOC_GETFLAGS
-#define FSFILT_IOC_GETFLAGS		_IOR('f', 1, long)
-#define FSFILT_IOC_SETFLAGS		_IOW('f', 2, long)
-#define FSFILT_IOC_GETVERSION		_IOR('f', 3, long)
-#define FSFILT_IOC_SETVERSION		_IOW('f', 4, long)
-#define FSFILT_IOC_GETVERSION_OLD	_IOR('v', 1, long)
-#define FSFILT_IOC_SETVERSION_OLD	_IOW('v', 2, long)
-#endif
+#define LL_IOC_GETVERSION		_IOR('f', 3, long)
+#define FSFILT_IOC_GETVERSION		LL_IOC_GETVERSION /* backward compat */
 
 /* FIEMAP flags supported by Lustre */
 #define LUSTRE_FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_DEVICE_ORDER)
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 07/33] lustre: obd: Reserve metadata overstriping flags
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (5 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 06/33] lustre: uapi: cleanup FSFILT defines James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 08/33] lnet: selftest: manage the workqueue state properly James Simmons
                   ` (25 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Patrick Farrell, Lustre Development List

From: Patrick Farrell <farr0186@gmail.com>

Reserve flag bits for metadata overstriping.

WC-bug-id: https://jira.whamcloud.com/browse/LU-12273
Lustre-commit: 8b62a8ca9c2e824d9 ("LU-12273 obd: Reserve metadata overstriping flags")
Signed-off-by: Patrick Farrell <farr0186@gmail.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49707
Reviewed-by: Qian Yingjin <qian@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/ptlrpc/wiretest.c             | 1 +
 include/uapi/linux/lustre/lustre_user.h | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/fs/lustre/ptlrpc/wiretest.c b/fs/lustre/ptlrpc/wiretest.c
index d4a2b82c961e..e336410a6ed1 100644
--- a/fs/lustre/ptlrpc/wiretest.c
+++ b/fs/lustre/ptlrpc/wiretest.c
@@ -1800,6 +1800,7 @@ void lustre_assert_wire_constants(void)
 	BUILD_BUG_ON(LMV_MAGIC_V1 != 0x0CD20CD0);
 	BUILD_BUG_ON(LMV_MAGIC_STRIPE != 0x0CD40CD0);
 	BUILD_BUG_ON(LMV_HASH_TYPE_MASK != 0x0000ffff);
+	BUILD_BUG_ON(LMV_HASH_FLAG_OVERSTRIPED != 0x01000000);
 	BUILD_BUG_ON(LMV_HASH_FLAG_FIXED != 0x02000000);
 	BUILD_BUG_ON(LMV_HASH_FLAG_MERGE != 0x04000000);
 	BUILD_BUG_ON(LMV_HASH_FLAG_SPLIT != 0x08000000);
diff --git a/include/uapi/linux/lustre/lustre_user.h b/include/uapi/linux/lustre/lustre_user.h
index 0383db67361d..7ee79e21e8ef 100644
--- a/include/uapi/linux/lustre/lustre_user.h
+++ b/include/uapi/linux/lustre/lustre_user.h
@@ -765,6 +765,8 @@ static inline bool lmv_is_known_hash_type(__u32 type)
 	       (type & LMV_HASH_TYPE_MASK) < LMV_HASH_TYPE_MAX;
 }
 
+/* This flag indicates that overstriping (>1 stripe per MDT) is desired */
+#define LMV_HASH_FLAG_OVERSTRIPED	0x01000000
 /* fixed layout, such directories won't split automatically */
 /* NB, update LMV_HASH_FLAG_KNOWN when adding new flag */
 #define LMV_HASH_FLAG_FIXED		0x02000000
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 08/33] lnet: selftest: manage the workqueue state properly
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (6 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 07/33] lustre: obd: Reserve metadata overstriping flags James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 09/33] lustre: remove cl_{offset, index, page_size} helpers James Simmons
                   ` (24 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Chris Horn, Frank Sehr, Serguei Smirnov, Lustre Development List

From: Mr NeilBrown <neilb@suse.de>

As lnet wants to provide a cpu mask of allowed cpus, it
needs to be a WQ_UNBOUND work queue so that tasks can
run on cpus other than where they were submitted.
We use alloc_ordered_workqueue for lst_sched_serial (now called
lst_serial_wq) - "ordered" means the same as "serial" did.
We use cfs_cpt_bind_queue() for the other workqueues which sets up the
CPU mask as required.

An important difference with workqueues is that there is no equivalent
to cfs_wi_exit() which can be called in the action function and which
will ensure the function is not called again - and that the item is no
longer queued.

To provide similar semantics we treat swi_state == SWI_STATE_DONE as
meaning that the wi is complete and any further calls must be no-op.
We also call cancel_work_sync() (via swi_cancel_workitem()) before
freeing or reusing memory that held a work-item.

To ensure the same exclusion that cfs_wi_exit() provided the state is
set and tested under a lock - either crpc_lock, scd_lock, or tsi_lock
depending on which structure the wi is embedded in.

Another minor difference is that with workqueues the action function
returns void, not an int.

Also change SWI_STATE_* from #define to an enum.  The only place these
values are ever stored is in one field in a struct.

These changes allow LNe selftest to work again.

Fixes: 6106c0f824 ("staging: lustre: lnet: convert selftest to use workqueues")
WC-bug-id: https://jira.whamcloud.com/browse/LU-9859
Lustre-commit: 51dd6269c91dab7543 ("LU-9859 lnet: convert selftest to use workqueues")
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/36991
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Frank Sehr <fsehr@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 net/lnet/selftest/framework.c | 29 +++++++++++++++++++++--------
 net/lnet/selftest/module.c    | 15 +++++++++------
 net/lnet/selftest/rpc.c       | 31 ++++++++++++++++---------------
 net/lnet/selftest/selftest.h  | 27 +++++++++++++++------------
 4 files changed, 61 insertions(+), 41 deletions(-)

diff --git a/net/lnet/selftest/framework.c b/net/lnet/selftest/framework.c
index 0dd0421ef8f6..4a7dbc9d786c 100644
--- a/net/lnet/selftest/framework.c
+++ b/net/lnet/selftest/framework.c
@@ -545,6 +545,7 @@ sfw_test_rpc_fini(struct srpc_client_rpc *rpc)
 
 	/* Called with hold of tsi->tsi_lock */
 	LASSERT(list_empty(&rpc->crpc_list));
+	rpc->crpc_wi.swi_state = SWI_STATE_DONE;
 	list_add(&rpc->crpc_list, &tsi->tsi_free_rpcs);
 }
 
@@ -651,6 +652,7 @@ sfw_destroy_test_instance(struct sfw_test_instance *tsi)
 					       struct srpc_client_rpc,
 					       crpc_list)) != NULL) {
 		list_del(&rpc->crpc_list);
+		swi_cancel_workitem(&rpc->crpc_wi);
 		kfree(rpc);
 	}
 
@@ -937,6 +939,7 @@ sfw_create_test_rpc(struct sfw_test_unit *tsu, struct lnet_process_id peer,
 					     blklen, sfw_test_rpc_done,
 					     sfw_test_rpc_fini, tsu);
 	} else {
+		swi_cancel_workitem(&rpc->crpc_wi);
 		srpc_init_client_rpc(rpc, peer, tsi->tsi_service, nblk,
 				     blklen, sfw_test_rpc_done,
 				     sfw_test_rpc_fini, tsu);
@@ -962,14 +965,20 @@ sfw_run_test(struct swi_workitem *wi)
 
 	if (tsi->tsi_ops->tso_prep_rpc(tsu, tsu->tsu_dest, &rpc)) {
 		LASSERT(!rpc);
+		wi->swi_state = SWI_STATE_DONE;
 		goto test_done;
 	}
 
 	LASSERT(rpc);
 
 	spin_lock(&tsi->tsi_lock);
+	if (wi->swi_state == SWI_STATE_DONE) {
+		spin_unlock(&tsi->tsi_lock);
+		return;
+	}
 
 	if (tsi->tsi_stopping) {
+		wi->swi_state = SWI_STATE_DONE;
 		list_add(&rpc->crpc_list, &tsi->tsi_free_rpcs);
 		spin_unlock(&tsi->tsi_lock);
 		goto test_done;
@@ -979,6 +988,7 @@ sfw_run_test(struct swi_workitem *wi)
 		tsu->tsu_loop--;
 
 	list_add_tail(&rpc->crpc_list, &tsi->tsi_active_rpcs);
+	wi->swi_state = SWI_STATE_RUNNING;
 	spin_unlock(&tsi->tsi_lock);
 
 	spin_lock(&rpc->crpc_lock);
@@ -1021,12 +1031,14 @@ sfw_run_batch(struct sfw_batch *tsb)
 		atomic_inc(&tsb->bat_nactive);
 
 		list_for_each_entry(tsu, &tsi->tsi_units, tsu_list) {
+			int cpt;
+
 			atomic_inc(&tsi->tsi_nactive);
 			tsu->tsu_loop = tsi->tsi_loop;
 			wi = &tsu->tsu_worker;
-			swi_init_workitem(wi, sfw_run_test,
-					  lst_test_wq[lnet_cpt_of_nid(tsu->tsu_dest.nid,
-							  NULL)]);
+
+			cpt = lnet_cpt_of_nid(tsu->tsu_dest.nid, NULL);
+			swi_init_workitem(wi, sfw_run_test, lst_test_wq[cpt]);
 			swi_schedule_workitem(wi);
 		}
 	}
@@ -1406,14 +1418,15 @@ sfw_create_rpc(struct lnet_process_id peer, int service,
 		rpc = list_first_entry(&sfw_data.fw_zombie_rpcs,
 				       struct srpc_client_rpc, crpc_list);
 		list_del(&rpc->crpc_list);
-
-		srpc_init_client_rpc(rpc, peer, service, 0, 0,
-				     done, sfw_client_rpc_fini, priv);
 	}
-
 	spin_unlock(&sfw_data.fw_lock);
 
-	if (!rpc) {
+	if (rpc) {
+		/* Ensure that rpc is done */
+		swi_cancel_workitem(&rpc->crpc_wi);
+		srpc_init_client_rpc(rpc, peer, service, 0, 0,
+				     done, sfw_client_rpc_fini, priv);
+	} else {
 		rpc = srpc_create_client_rpc(peer, service,
 					     nbulkiov, bulklen, done,
 					     nbulkiov ?  NULL :
diff --git a/net/lnet/selftest/module.c b/net/lnet/selftest/module.c
index 333f392b22bc..3743bce0cccd 100644
--- a/net/lnet/selftest/module.c
+++ b/net/lnet/selftest/module.c
@@ -88,7 +88,7 @@ static int
 lnet_selftest_init(void)
 {
 	int nscheds;
-	int rc;
+	int rc = -ENOMEM;
 	int i;
 
 	rc = libcfs_setup();
@@ -118,11 +118,14 @@ lnet_selftest_init(void)
 
 		/* reserve at least one CPU for LND */
 		nthrs = max(nthrs - 1, 1);
-		lst_test_wq[i] = alloc_workqueue("lst_t", WQ_UNBOUND, nthrs);
-		if (!lst_test_wq[i]) {
-			CWARN("Failed to create CPU partition affinity WI scheduler %d for LST\n",
-			      i);
-			rc = -ENOMEM;
+		lst_test_wq[i] = cfs_cpt_bind_workqueue("lst_t",
+							lnet_cpt_table(), 0,
+							i, nthrs);
+		if (IS_ERR(lst_test_wq[i])) {
+			rc = PTR_ERR(lst_test_wq[i]);
+			CERROR("Failed to create CPU partition affinity WI scheduler %d for LST: rc = %d\n",
+			       i, rc);
+			lst_test_wq[i] = NULL;
 			goto error;
 		}
 
diff --git a/net/lnet/selftest/rpc.c b/net/lnet/selftest/rpc.c
index c75addc74cad..f5730ada7d85 100644
--- a/net/lnet/selftest/rpc.c
+++ b/net/lnet/selftest/rpc.c
@@ -93,8 +93,7 @@ srpc_serv_portal(int svc_id)
 }
 
 /* forward ref's */
-void srpc_handle_rpc(struct swi_workitem *wi);
-
+static void srpc_handle_rpc(struct swi_workitem *wi);
 
 void srpc_get_counters(struct srpc_counters *cnt)
 {
@@ -295,8 +294,7 @@ srpc_service_init(struct srpc_service *svc)
 		scd->scd_ev.ev_data = scd;
 		scd->scd_ev.ev_type = SRPC_REQUEST_RCVD;
 
-		/*
-		 * NB: don't use lst_serial_wq for adding buffer,
+		/* NB: don't use lst_serial_wq for adding buffer,
 		 * see details in srpc_service_add_buffers()
 		 */
 		swi_init_workitem(&scd->scd_buf_wi,
@@ -601,6 +599,7 @@ srpc_add_buffer(struct swi_workitem *wi)
 		scd->scd_buf_posting--;
 	}
 
+	wi->swi_state = SWI_STATE_RUNNING;
 	spin_unlock(&scd->scd_lock);
 }
 
@@ -933,8 +932,6 @@ srpc_server_rpc_done(struct srpc_server_rpc *rpc, int status)
 	struct srpc_service *sv = scd->scd_svc;
 	struct srpc_buffer *buffer;
 
-	LASSERT(status || rpc->srpc_wi.swi_state == SWI_STATE_DONE);
-
 	rpc->srpc_status = status;
 
 	CDEBUG_LIMIT(!status ? D_NET : D_NETERROR,
@@ -969,6 +966,7 @@ srpc_server_rpc_done(struct srpc_server_rpc *rpc, int status)
 	 * Cancel pending schedules and prevent future schedule attempts:
 	 */
 	LASSERT(rpc->srpc_ev.ev_fired);
+	rpc->srpc_wi.swi_state = SWI_STATE_DONE;
 
 	if (!sv->sv_shuttingdown && !list_empty(&scd->scd_buf_blocked)) {
 		buffer = list_first_entry(&scd->scd_buf_blocked,
@@ -986,8 +984,7 @@ srpc_server_rpc_done(struct srpc_server_rpc *rpc, int status)
 }
 
 /* handles an incoming RPC */
-void
-srpc_handle_rpc(struct swi_workitem *wi)
+static void srpc_handle_rpc(struct swi_workitem *wi)
 {
 	struct srpc_server_rpc *rpc = container_of(wi, struct srpc_server_rpc,
 						   srpc_wi);
@@ -996,20 +993,22 @@ srpc_handle_rpc(struct swi_workitem *wi)
 	struct srpc_event *ev = &rpc->srpc_ev;
 	int rc = 0;
 
-	LASSERT(wi == &rpc->srpc_wi);
-
 	spin_lock(&scd->scd_lock);
+	if (wi->swi_state == SWI_STATE_DONE) {
+		spin_unlock(&scd->scd_lock);
+		return;
+	}
 
 	if (sv->sv_shuttingdown || rpc->srpc_aborted) {
+		wi->swi_state = SWI_STATE_DONE;
 		spin_unlock(&scd->scd_lock);
 
 		if (rpc->srpc_bulk)
 			LNetMDUnlink(rpc->srpc_bulk->bk_mdh);
 		LNetMDUnlink(rpc->srpc_replymdh);
 
-		if (ev->ev_fired) { /* no more event, OK to finish */
+		if (ev->ev_fired) /* no more event, OK to finish */
 			srpc_server_rpc_done(rpc, -ESHUTDOWN);
-		}
 		return;
 	}
 
@@ -1069,7 +1068,6 @@ srpc_handle_rpc(struct swi_workitem *wi)
 
 			if (sv->sv_bulk_ready)
 				rc = (*sv->sv_bulk_ready) (rpc, rc);
-
 			if (rc) {
 				srpc_server_rpc_done(rpc, rc);
 				return;
@@ -1164,8 +1162,6 @@ srpc_client_rpc_done(struct srpc_client_rpc *rpc, int status)
 {
 	struct swi_workitem *wi = &rpc->crpc_wi;
 
-	LASSERT(status || wi->swi_state == SWI_STATE_DONE);
-
 	spin_lock(&rpc->crpc_lock);
 
 	rpc->crpc_closed = 1;
@@ -1188,6 +1184,7 @@ srpc_client_rpc_done(struct srpc_client_rpc *rpc, int status)
 	 * Cancel pending schedules and prevent future schedule attempts:
 	 */
 	LASSERT(!srpc_event_pending(rpc));
+	wi->swi_state = SWI_STATE_DONE;
 
 	spin_unlock(&rpc->crpc_lock);
 
@@ -1214,6 +1211,10 @@ srpc_send_rpc(struct swi_workitem *wi)
 	do_bulk = rpc->crpc_bulk.bk_niov > 0;
 
 	spin_lock(&rpc->crpc_lock);
+	if (wi->swi_state == SWI_STATE_DONE) {
+		spin_unlock(&rpc->crpc_lock);
+		return;
+	}
 
 	if (rpc->crpc_aborted) {
 		spin_unlock(&rpc->crpc_lock);
diff --git a/net/lnet/selftest/selftest.h b/net/lnet/selftest/selftest.h
index 5d0b47fe7e49..ceefd850f996 100644
--- a/net/lnet/selftest/selftest.h
+++ b/net/lnet/selftest/selftest.h
@@ -126,14 +126,18 @@ enum lnet_selftest_group_nodelist_prop_attrs {
 
 #define LNET_SELFTEST_GROUP_NODELIST_PROP_MAX	(__LNET_SELFTEST_GROUP_NODELIST_PROP_MAX_PLUS_ONE - 1)
 
-#define SWI_STATE_NEWBORN		0
-#define SWI_STATE_REPLY_SUBMITTED	1
-#define SWI_STATE_REPLY_SENT		2
-#define SWI_STATE_REQUEST_SUBMITTED	3
-#define SWI_STATE_REQUEST_SENT		4
-#define SWI_STATE_REPLY_RECEIVED	5
-#define SWI_STATE_BULK_STARTED		6
-#define SWI_STATE_DONE			10
+enum lsr_swi_state {
+	SWI_STATE_DONE = 0,
+	SWI_STATE_NEWBORN,
+	SWI_STATE_REPLY_SUBMITTED,
+	SWI_STATE_REPLY_SENT,
+	SWI_STATE_REQUEST_SUBMITTED,
+	SWI_STATE_REQUEST_SENT,
+	SWI_STATE_REPLY_RECEIVED,
+	SWI_STATE_BULK_STARTED,
+	SWI_STATE_RUNNING,
+	SWI_STATE_PAUSE,
+};
 
 /* forward refs */
 struct srpc_service;
@@ -248,9 +252,9 @@ typedef void (*swi_action_t) (struct swi_workitem *);
 
 struct swi_workitem {
 	struct workqueue_struct *swi_wq;
-	struct work_struct  swi_work;
-	swi_action_t	    swi_action;
-	int		    swi_state;
+	struct work_struct	swi_work;
+	swi_action_t		swi_action;
+	enum lsr_swi_state	swi_state;
 };
 
 /* server-side state of a RPC */
@@ -562,7 +566,6 @@ swi_wi_action(struct work_struct *wi)
 	struct swi_workitem *swi;
 
 	swi = container_of(wi, struct swi_workitem, swi_work);
-
 	swi->swi_action(swi);
 }
 
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 09/33] lustre: remove cl_{offset, index, page_size} helpers
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (7 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 08/33] lnet: selftest: manage the workqueue state properly James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 10/33] lustre: csdc: reserve layout bits for compress component James Simmons
                   ` (23 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Wang Shilong, Lustre Development List

From: Wang Shilong <wshilong@ddn.com>

These helpers could be replaced with PAGE_SIZE and PAGE_SHIFT calculation
directly which avoid CPU overhead.

WC-bug-id: https://jira.whamcloud.com/browse/LU-13199
Lustre-commit: b34bf55f9493778c3 ("LU-13199 lustre: remove cl_{offset,index,page_size} helpers")
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/37426
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/include/cl_object.h |  2 --
 fs/lustre/llite/file.c        |  4 ++--
 fs/lustre/llite/llite_lib.c   |  4 ++--
 fs/lustre/llite/llite_mmap.c  |  4 ++--
 fs/lustre/llite/rw.c          |  8 ++++----
 fs/lustre/llite/rw26.c        |  4 ++--
 fs/lustre/llite/vvp_io.c      | 20 ++++++++------------
 fs/lustre/lov/lov_io.c        | 19 ++++++++-----------
 fs/lustre/lov/lov_lock.c      |  8 ++++----
 fs/lustre/lov/lov_page.c      | 16 ++++++++--------
 fs/lustre/mdc/mdc_dev.c       |  4 ++--
 fs/lustre/obdclass/cl_page.c  | 24 ------------------------
 fs/lustre/osc/osc_cache.c     | 25 ++++++++++++-------------
 fs/lustre/osc/osc_io.c        | 28 ++++++++++++++--------------
 fs/lustre/osc/osc_lock.c      | 20 ++++++++++----------
 fs/lustre/osc/osc_page.c      |  6 +++---
 16 files changed, 81 insertions(+), 115 deletions(-)

diff --git a/fs/lustre/include/cl_object.h b/fs/lustre/include/cl_object.h
index 94e7f8060d4a..9d940cbdb249 100644
--- a/fs/lustre/include/cl_object.h
+++ b/fs/lustre/include/cl_object.h
@@ -2260,8 +2260,6 @@ void cl_page_discard(const struct lu_env *env, struct cl_io *io,
 void cl_page_delete(const struct lu_env *env, struct cl_page *pg);
 void cl_page_touch(const struct lu_env *env, const struct cl_page *pg,
 		   size_t to);
-loff_t cl_offset(const struct cl_object *obj, pgoff_t idx);
-pgoff_t cl_index(const struct cl_object *obj, loff_t offset);
 int cl_pages_prune(const struct lu_env *env, struct cl_object *obj);
 
 void cl_lock_print(const struct lu_env *env, void *cookie,
diff --git a/fs/lustre/llite/file.c b/fs/lustre/llite/file.c
index b2751b571ea9..e5bbe35de473 100644
--- a/fs/lustre/llite/file.c
+++ b/fs/lustre/llite/file.c
@@ -3471,8 +3471,8 @@ int ll_file_lock_ahead(struct file *file, struct llapi_lu_ladvise *ladvise)
 
 		descr->cld_obj = io->ci_obj;
 		/* Convert byte offsets to pages */
-		descr->cld_start = cl_index(io->ci_obj, start);
-		descr->cld_end = cl_index(io->ci_obj, end);
+		descr->cld_start = start >> PAGE_SHIFT;
+		descr->cld_end = end >> PAGE_SHIFT;
 		descr->cld_mode = cl_mode;
 		/* CEF_MUST is used because we do not want to convert a
 		 * lockahead request to a lockless lock
diff --git a/fs/lustre/llite/llite_lib.c b/fs/lustre/llite/llite_lib.c
index a9acce572e32..908ca3d43ee3 100644
--- a/fs/lustre/llite/llite_lib.c
+++ b/fs/lustre/llite/llite_lib.c
@@ -1922,8 +1922,8 @@ int ll_io_zero_page(struct inode *inode, pgoff_t index, pgoff_t offset,
 	lock = vvp_env_lock(env);
 	descr = &lock->cll_descr;
 	descr->cld_obj = io->ci_obj;
-	descr->cld_start = cl_index(io->ci_obj, from);
-	descr->cld_end = cl_index(io->ci_obj, from + PAGE_SIZE - 1);
+	descr->cld_start = from >> PAGE_SHIFT;
+	descr->cld_end = (from + PAGE_SIZE - 1) >> PAGE_SHIFT;
 	descr->cld_mode = CLM_WRITE;
 	descr->cld_enq_flags = CEF_MUST | CEF_NONBLOCK;
 
diff --git a/fs/lustre/llite/llite_mmap.c b/fs/lustre/llite/llite_mmap.c
index d6c1a6fd0794..509855837582 100644
--- a/fs/lustre/llite/llite_mmap.c
+++ b/fs/lustre/llite/llite_mmap.c
@@ -449,7 +449,7 @@ static vm_fault_t ll_fault(struct vm_fault *vmf)
 	if (vmf->page && result == VM_FAULT_LOCKED) {
 		ll_rw_stats_tally(ll_i2sbi(file_inode(vma->vm_file)),
 				  current->pid, vma->vm_file->private_data,
-				  cl_offset(NULL, vmf->page->index), PAGE_SIZE,
+				  vmf->page->index << PAGE_SHIFT, PAGE_SIZE,
 				  READ);
 		ll_stats_ops_tally(ll_i2sbi(file_inode(vma->vm_file)),
 				   LPROC_LL_FAULT,
@@ -522,7 +522,7 @@ static vm_fault_t ll_page_mkwrite(struct vm_fault *vmf)
 	if (ret == VM_FAULT_LOCKED) {
 		ll_rw_stats_tally(ll_i2sbi(file_inode(vma->vm_file)),
 				  current->pid, vma->vm_file->private_data,
-				  cl_offset(NULL, vmf->page->index), PAGE_SIZE,
+				  vmf->page->index << PAGE_SHIFT, PAGE_SIZE,
 				  WRITE);
 		ll_stats_ops_tally(ll_i2sbi(file_inode(vma->vm_file)),
 				   LPROC_LL_MKWRITE,
diff --git a/fs/lustre/llite/rw.c b/fs/lustre/llite/rw.c
index 9b1cf71116df..c7adfc6d4faf 100644
--- a/fs/lustre/llite/rw.c
+++ b/fs/lustre/llite/rw.c
@@ -1513,7 +1513,7 @@ int ll_writepage(struct page *vmpage, struct writeback_control *wbc)
 	cl_io_fini(env, io);
 
 	if (redirtied && wbc->sync_mode == WB_SYNC_ALL) {
-		loff_t offset = cl_offset(clob, vmpage->index);
+		loff_t offset = vmpage->index << PAGE_SHIFT;
 
 		/* Flush page failed because the extent is being written out.
 		 * Wait for the write of extent to be finished to avoid
@@ -1695,9 +1695,9 @@ int ll_io_read_page(const struct lu_env *env, struct cl_io *io,
 
 	/* mmap does not set the ci_rw fields */
 	if (!mmap) {
-		io_start_index = cl_index(io->ci_obj, io->u.ci_rw.crw_pos);
-		io_end_index = cl_index(io->ci_obj, io->u.ci_rw.crw_pos +
-					io->u.ci_rw.crw_count - 1);
+		io_start_index = io->u.ci_rw.crw_pos >> PAGE_SHIFT;
+		io_end_index = (io->u.ci_rw.crw_pos +
+				io->u.ci_rw.crw_count - 1) >> PAGE_SHIFT;
 	} else {
 		io_start_index = cl_page_index(page);
 		io_end_index = cl_page_index(page);
diff --git a/fs/lustre/llite/rw26.c b/fs/lustre/llite/rw26.c
index 2065e14e8469..5f0186cb9ecb 100644
--- a/fs/lustre/llite/rw26.c
+++ b/fs/lustre/llite/rw26.c
@@ -217,7 +217,7 @@ ll_direct_rw_pages(const struct lu_env *env, struct cl_io *io, size_t size,
 	cl_2queue_init(queue);
 	for (i = 0; i < pv->ldp_count; i++) {
 		LASSERT(!(offset & (PAGE_SIZE - 1)));
-		page = cl_page_find(env, obj, cl_index(obj, offset),
+		page = cl_page_find(env, obj, offset >> PAGE_SHIFT,
 				    pv->ldp_pages[i], CPT_TRANSIENT);
 		if (IS_ERR(page)) {
 			rc = PTR_ERR(page);
@@ -451,7 +451,7 @@ static int ll_prepare_partial_page(const struct lu_env *env, struct cl_io *io,
 {
 	struct cl_attr *attr = vvp_env_thread_attr(env);
 	struct cl_object *obj = io->ci_obj;
-	loff_t offset = cl_offset(obj, cl_page_index(pg));
+	loff_t offset = cl_page_index(pg) << PAGE_SHIFT;
 	int result;
 
 	cl_object_attr_lock(obj);
diff --git a/fs/lustre/llite/vvp_io.c b/fs/lustre/llite/vvp_io.c
index 86dab3b1a39f..1b5628d1502d 100644
--- a/fs/lustre/llite/vvp_io.c
+++ b/fs/lustre/llite/vvp_io.c
@@ -239,10 +239,8 @@ static int vvp_io_one_lock(const struct lu_env *env, struct cl_io *io,
 			   u32 enqflags, enum cl_lock_mode mode,
 			   loff_t start, loff_t end)
 {
-	struct cl_object *obj = io->ci_obj;
-
 	return vvp_io_one_lock_index(env, io, enqflags, mode,
-				     cl_index(obj, start), cl_index(obj, end));
+				     start >> PAGE_SHIFT, end >> PAGE_SHIFT);
 }
 
 static int vvp_io_write_iter_init(const struct lu_env *env,
@@ -483,10 +481,8 @@ static int vvp_mmap_locks(const struct lu_env *env,
 			policy_from_vma(&policy, vma, addr, count);
 			descr->cld_mode = vvp_mode_from_vma(vma);
 			descr->cld_obj = ll_i2info(inode)->lli_clob;
-			descr->cld_start = cl_index(descr->cld_obj,
-						    policy.l_extent.start);
-			descr->cld_end = cl_index(descr->cld_obj,
-						  policy.l_extent.end);
+			descr->cld_start = policy.l_extent.start >> PAGE_SHIFT;
+			descr->cld_end = policy.l_extent.end >> PAGE_SHIFT;
 			descr->cld_enq_flags = flags;
 			result = cl_io_lock_alloc_add(env, io, descr);
 
@@ -854,7 +850,7 @@ static int vvp_io_read_start(const struct lu_env *env,
 	/* initialize read-ahead window once per syscall */
 	if (!vio->vui_ra_valid) {
 		vio->vui_ra_valid = true;
-		vio->vui_ra_start_idx = cl_index(obj, pos);
+		vio->vui_ra_start_idx = pos >> PAGE_SHIFT;
 		vio->vui_ra_pages = 0;
 		page_offset = pos & ~PAGE_MASK;
 		if (page_offset) {
@@ -1408,8 +1404,8 @@ static int vvp_io_fault_start(const struct lu_env *env,
 	trunc_sem_down_read_nowait(&lli->lli_trunc_sem);
 
 	/* offset of the last byte on the page */
-	offset = cl_offset(obj, fio->ft_index + 1) - 1;
-	LASSERT(cl_index(obj, offset) == fio->ft_index);
+	offset = ((fio->ft_index + 1) << PAGE_SHIFT) - 1;
+	LASSERT((offset >> PAGE_SHIFT) == fio->ft_index);
 	result = vvp_prep_size(env, obj, io, 0, offset + 1, NULL);
 	if (result != 0)
 		return result;
@@ -1445,7 +1441,7 @@ static int vvp_io_fault_start(const struct lu_env *env,
 		goto out;
 	}
 
-	last_index = cl_index(obj, size - 1);
+	last_index = (size - 1) >> PAGE_SHIFT;
 
 	if (fio->ft_mkwrite) {
 		/*
@@ -1558,7 +1554,7 @@ static int vvp_io_fault_start(const struct lu_env *env,
 		/*
 		 * Last page is mapped partially.
 		 */
-		fio->ft_nob = size - cl_offset(obj, fio->ft_index);
+		fio->ft_nob = size - (fio->ft_index << PAGE_SHIFT);
 	else
 		fio->ft_nob = PAGE_SIZE;
 
diff --git a/fs/lustre/lov/lov_io.c b/fs/lustre/lov/lov_io.c
index 4c842cd2b67d..eda8e3752a15 100644
--- a/fs/lustre/lov/lov_io.c
+++ b/fs/lustre/lov/lov_io.c
@@ -514,8 +514,8 @@ static int lov_io_slice_init(struct lov_io *lio, struct lov_object *obj,
 	case CIT_FAULT: {
 		pgoff_t index = io->u.ci_fault.ft_index;
 
-		lio->lis_pos = cl_offset(io->ci_obj, index);
-		lio->lis_endpos = cl_offset(io->ci_obj, index + 1);
+		lio->lis_pos = index << PAGE_SHIFT;
+		lio->lis_endpos = (index + 1) << PAGE_SHIFT;
 		break;
 	}
 
@@ -699,12 +699,11 @@ static void lov_io_sub_inherit(struct lov_io_sub *sub, struct lov_io *lio,
 		break;
 	}
 	case CIT_FAULT: {
-		struct cl_object *obj = parent->ci_obj;
-		u64 off = cl_offset(obj, parent->u.ci_fault.ft_index);
+		loff_t off = parent->u.ci_fault.ft_index << PAGE_SHIFT;
 
 		io->u.ci_fault = parent->u.ci_fault;
 		off = lov_size_to_stripe(lsm, index, off, stripe);
-		io->u.ci_fault.ft_index = cl_index(obj, off);
+		io->u.ci_fault.ft_index = off >> PAGE_SHIFT;
 		break;
 	}
 	case CIT_FSYNC: {
@@ -1131,7 +1130,6 @@ static int lov_io_read_ahead(const struct lu_env *env,
 {
 	struct lov_io *lio = cl2lov_io(env, ios);
 	struct lov_object *loo = lio->lis_object;
-	struct cl_object *obj = lov2cl(loo);
 	struct lov_layout_raid0 *r0;
 	unsigned int pps; /* pages per stripe */
 	struct lov_io_sub *sub;
@@ -1142,7 +1140,7 @@ static int lov_io_read_ahead(const struct lu_env *env,
 	int index;
 	int rc;
 
-	offset = cl_offset(obj, start);
+	offset = start << PAGE_SHIFT;
 	index = lov_io_layout_at(lio, offset);
 	if (index < 0 || !lsm_entry_inited(loo->lo_lsm, index) ||
 	    lsm_entry_is_foreign(loo->lo_lsm, index))
@@ -1164,8 +1162,7 @@ static int lov_io_read_ahead(const struct lu_env *env,
 
 	lov_stripe_offset(loo->lo_lsm, index, offset, stripe, &suboff);
 	rc = cl_io_read_ahead(sub->sub_env, &sub->sub_io,
-			      cl_index(lovsub2cl(r0->lo_sub[stripe]), suboff),
-			      ra);
+			      suboff >> PAGE_SHIFT, ra);
 
 	CDEBUG(D_READA, DFID " cra_end = %lu, stripes = %d, rc = %d\n",
 	       PFID(lu_object_fid(lov2lu(loo))), ra->cra_end_idx,
@@ -1188,7 +1185,7 @@ static int lov_io_read_ahead(const struct lu_env *env,
 						   ra_end, stripe);
 
 	/* boundary of current component */
-	ra_end = cl_index(obj, (loff_t)lov_io_extent(lio, index)->e_end);
+	ra_end = lov_io_extent(lio, index)->e_end >> PAGE_SHIFT;
 	if (ra_end != CL_PAGE_EOF && ra->cra_end_idx >= ra_end)
 		ra->cra_end_idx = ra_end - 1;
 
@@ -1444,7 +1441,7 @@ static int lov_io_fault_start(const struct lu_env *env,
 	 * refer to another mirror of an old IO.
 	 */
 	if (lov_is_flr(lio->lis_object)) {
-		offset = cl_offset(ios->cis_obj, fio->ft_index);
+		offset = fio->ft_index << PAGE_SHIFT;
 		entry = lov_io_layout_at(lio, offset);
 		if (entry < 0) {
 			CERROR(DFID": page fault index %lu invalid component: %d, mirror: %d\n",
diff --git a/fs/lustre/lov/lov_lock.c b/fs/lustre/lov/lov_lock.c
index 313c09ae0e24..f2b24cabea01 100644
--- a/fs/lustre/lov/lov_lock.c
+++ b/fs/lustre/lov/lov_lock.c
@@ -128,11 +128,11 @@ static struct lov_lock *lov_lock_sub_init(const struct lu_env *env,
 
 	LASSERT(ergo(is_trunc, lio->lis_trunc_stripe_index != NULL));
 
-	ext.e_start = cl_offset(obj, lock->cll_descr.cld_start);
+	ext.e_start = lock->cll_descr.cld_start << PAGE_SHIFT;
 	if (lock->cll_descr.cld_end == CL_PAGE_EOF)
 		ext.e_end = OBD_OBJECT_EOF;
 	else
-		ext.e_end = cl_offset(obj, lock->cll_descr.cld_end + 1);
+		ext.e_end = (lock->cll_descr.cld_end + 1) << PAGE_SHIFT;
 
 	nr = 0;
 	lov_foreach_io_layout(index, lio, &ext) {
@@ -185,8 +185,8 @@ static struct lov_lock *lov_lock_sub_init(const struct lu_env *env,
 			descr = &lls->sub_lock.cll_descr;
 			LASSERT(!descr->cld_obj);
 			descr->cld_obj = lovsub2cl(r0->lo_sub[i]);
-			descr->cld_start = cl_index(descr->cld_obj, start);
-			descr->cld_end = cl_index(descr->cld_obj, end);
+			descr->cld_start = start >> PAGE_SHIFT;
+			descr->cld_end = end >> PAGE_SHIFT;
 			descr->cld_mode = lock->cll_descr.cld_mode;
 			descr->cld_gid = lock->cll_descr.cld_gid;
 			descr->cld_enq_flags = lock->cll_descr.cld_enq_flags;
diff --git a/fs/lustre/lov/lov_page.c b/fs/lustre/lov/lov_page.c
index e9283aa73765..de5264318577 100644
--- a/fs/lustre/lov/lov_page.c
+++ b/fs/lustre/lov/lov_page.c
@@ -75,7 +75,7 @@ int lov_page_init_composite(const struct lu_env *env, struct cl_object *obj,
 	stripe_cached = lio->lis_cached_entry != LIS_CACHE_ENTRY_NONE &&
 			page->cp_type == CPT_TRANSIENT;
 
-	offset = cl_offset(obj, index);
+	offset = index << PAGE_SHIFT;
 
 	if (stripe_cached) {
 		entry = lio->lis_cached_entry;
@@ -126,7 +126,7 @@ int lov_page_init_composite(const struct lu_env *env, struct cl_object *obj,
 	cl_object_for_each(o, subobj) {
 		if (o->co_ops->coo_page_init) {
 			rc = o->co_ops->coo_page_init(sub->sub_env, o, page,
-						      cl_index(subobj, suboff));
+						      suboff >> PAGE_SHIFT);
 			if (rc != 0)
 				break;
 		}
@@ -136,17 +136,17 @@ int lov_page_init_composite(const struct lu_env *env, struct cl_object *obj,
 }
 
 int lov_page_init_empty(const struct lu_env *env, struct cl_object *obj,
-			struct cl_page *page, pgoff_t index)
+			struct cl_page *cl_page, pgoff_t index)
 {
 	void *addr;
 
-	BUILD_BUG_ON(!__same_type(page->cp_lov_index, CP_LOV_INDEX_EMPTY));
-	page->cp_lov_index = CP_LOV_INDEX_EMPTY;
+	BUILD_BUG_ON(!__same_type(cl_page->cp_lov_index, CP_LOV_INDEX_EMPTY));
+	cl_page->cp_lov_index = CP_LOV_INDEX_EMPTY;
 
-	addr = kmap(page->cp_vmpage);
+	addr = kmap(cl_page->cp_vmpage);
 	memset(addr, 0, PAGE_SIZE);
-	kunmap(page->cp_vmpage);
-	SetPageUptodate(page->cp_vmpage);
+	kunmap(cl_page->cp_vmpage);
+	SetPageUptodate(cl_page->cp_vmpage);
 	return 0;
 }
 
diff --git a/fs/lustre/mdc/mdc_dev.c b/fs/lustre/mdc/mdc_dev.c
index 74911da6822b..a205a8de3249 100644
--- a/fs/lustre/mdc/mdc_dev.c
+++ b/fs/lustre/mdc/mdc_dev.c
@@ -332,7 +332,7 @@ static int mdc_dlm_canceling(const struct lu_env *env,
 		struct cl_attr *attr = &osc_env_info(env)->oti_attr;
 
 		/* Destroy pages covered by the extent of the DLM lock */
-		result = mdc_lock_flush(env, cl2osc(obj), cl_index(obj, 0),
+		result = mdc_lock_flush(env, cl2osc(obj), 0,
 					CL_PAGE_EOF, mode, discard);
 		/* Losing a lock, set KMS to 0.
 		 * NB: assumed that DOM lock covers whole data on MDT.
@@ -489,7 +489,7 @@ static void mdc_lock_granted(const struct lu_env *env, struct osc_lock *oscl,
 		 * we decide whether to grant a lockless lock.
 		 */
 		descr->cld_mode = osc_ldlm2cl_lock(dlmlock->l_granted_mode);
-		descr->cld_start = cl_index(descr->cld_obj, 0);
+		descr->cld_start = 0;
 		descr->cld_end = CL_PAGE_EOF;
 
 		/* no lvb update for matched lock */
diff --git a/fs/lustre/obdclass/cl_page.c b/fs/lustre/obdclass/cl_page.c
index 80423b745650..ecfccdb2c945 100644
--- a/fs/lustre/obdclass/cl_page.c
+++ b/fs/lustre/obdclass/cl_page.c
@@ -1015,30 +1015,6 @@ void cl_page_print(const struct lu_env *env, void *cookie,
 }
 EXPORT_SYMBOL(cl_page_print);
 
-/**
- * Converts a byte offset within object @obj into a page index.
- */
-loff_t cl_offset(const struct cl_object *obj, pgoff_t idx)
-{
-	/*
-	 * XXX for now.
-	 */
-	return (loff_t)idx << PAGE_SHIFT;
-}
-EXPORT_SYMBOL(cl_offset);
-
-/**
- * Converts a page index into a byte offset within object @obj.
- */
-pgoff_t cl_index(const struct cl_object *obj, loff_t offset)
-{
-	/*
-	 * XXX for now.
-	 */
-	return offset >> PAGE_SHIFT;
-}
-EXPORT_SYMBOL(cl_index);
-
 /**
  * Adds page slice to the compound page.
  *
diff --git a/fs/lustre/osc/osc_cache.c b/fs/lustre/osc/osc_cache.c
index dddf98f38782..691ebc0ad46a 100644
--- a/fs/lustre/osc/osc_cache.c
+++ b/fs/lustre/osc/osc_cache.c
@@ -249,13 +249,13 @@ static int __osc_extent_sanity_check(struct osc_extent *ext,
 	}
 
 	if (ext->oe_dlmlock &&
-	    ext->oe_dlmlock->l_resource->lr_type == LDLM_EXTENT &&
-	    !ldlm_is_failed(ext->oe_dlmlock)) {
+			ext->oe_dlmlock->l_resource->lr_type == LDLM_EXTENT &&
+			!ldlm_is_failed(ext->oe_dlmlock)) {
 		struct ldlm_extent *extent;
 
 		extent = &ext->oe_dlmlock->l_policy_data.l_extent;
-		if (!(extent->start <= cl_offset(osc2cl(obj), ext->oe_start) &&
-		      extent->end >= cl_offset(osc2cl(obj), ext->oe_max_end))) {
+		if (!(extent->start <= ext->oe_start << PAGE_SHIFT &&
+		      extent->end >= ext->oe_max_end << PAGE_SHIFT)) {
 			rc = 100;
 			goto out;
 		}
@@ -1331,10 +1331,10 @@ static int osc_refresh_count(const struct lu_env *env,
 		return result;
 
 	kms = attr->cat_kms;
-	if (cl_offset(obj, index) >= kms)
+	if (index << PAGE_SHIFT >= kms)
 		/* catch race with truncate */
 		return 0;
-	else if (cl_offset(obj, index + 1) > kms)
+	else if ((index + 1) << PAGE_SHIFT > kms)
 		/* catch sub-page write at end of file */
 		return kms & ~PAGE_MASK;
 	else
@@ -2777,8 +2777,8 @@ int osc_cache_truncate_start(const struct lu_env *env, struct osc_object *obj,
 	bool partial;
 
 	/* pages with index greater or equal to index will be truncated. */
-	index = cl_index(osc2cl(obj), size);
-	partial = size > cl_offset(osc2cl(obj), index);
+	index = size >> PAGE_SHIFT;
+	partial = size > (index << PAGE_SHIFT);
 
 again:
 	osc_object_lock(obj);
@@ -3248,12 +3248,11 @@ static bool check_and_discard_cb(const struct lu_env *env, struct cl_io *io,
 				u64 start = tmp->l_policy_data.l_extent.start;
 
 				/* no lock covering this page */
-				if (index < cl_index(osc2cl(osc), start)) {
+				if (index < start >> PAGE_SHIFT) {
 					/* no lock at @index,
 					 * first lock at @start
 					 */
-					info->oti_ng_index = cl_index(osc2cl(osc),
-								      start);
+					info->oti_ng_index = start >> PAGE_SHIFT;
 					discard = true;
 				} else {
 					/* Cache the first-non-overlapped
@@ -3263,8 +3262,8 @@ static bool check_and_discard_cb(const struct lu_env *env, struct cl_io *io,
 					 * is canceled, it will discard these
 					 * pages.
 					 */
-					info->oti_fn_index = cl_index(osc2cl(osc),
-								      end + 1);
+					info->oti_fn_index =
+						(end + 1) >> PAGE_SHIFT;
 					if (end == OBD_OBJECT_EOF)
 						info->oti_fn_index = CL_PAGE_EOF;
 				}
diff --git a/fs/lustre/osc/osc_io.c b/fs/lustre/osc/osc_io.c
index d0ee74823ade..71bfe60ad40a 100644
--- a/fs/lustre/osc/osc_io.c
+++ b/fs/lustre/osc/osc_io.c
@@ -95,16 +95,16 @@ static int osc_io_read_ahead(const struct lu_env *env,
 		}
 
 		ra->cra_rpc_pages = osc_cli(osc)->cl_max_pages_per_rpc;
-		ra->cra_end_idx = cl_index(osc2cl(osc),
-					   dlmlock->l_policy_data.l_extent.end);
+		ra->cra_end_idx =
+			dlmlock->l_policy_data.l_extent.end >> PAGE_SHIFT;
 		ra->cra_release = osc_read_ahead_release;
 		ra->cra_dlmlock = dlmlock;
 		ra->cra_oio = oio;
 		if (ra->cra_end_idx != CL_PAGE_EOF)
 			ra->cra_contention = true;
-		ra->cra_end_idx = min_t(pgoff_t, ra->cra_end_idx,
-					cl_index(osc2cl(osc),
-						 oinfo->loi_kms - 1));
+		ra->cra_end_idx = min_t(pgoff_t,
+					ra->cra_end_idx,
+					(oinfo->loi_kms - 1) >> PAGE_SHIFT);
 		result = 0;
 	}
 
@@ -270,7 +270,7 @@ void osc_page_touch_at(const struct lu_env *env, struct cl_object *obj,
 	u64 kms;
 
 	/* offset within stripe */
-	kms = cl_offset(obj, idx) + to;
+	kms = (idx << PAGE_SHIFT) + to;
 
 	cl_object_attr_lock(obj);
 	CDEBUG(D_INODE, "stripe KMS %sincreasing %llu->%llu %llu\n",
@@ -533,8 +533,8 @@ static void osc_trunc_check(const struct lu_env *env, struct cl_io *io,
 	pgoff_t start;
 
 	clob = oio->oi_cl.cis_obj;
-	start = cl_index(clob, size);
-	partial = cl_offset(clob, start) < size;
+	start = size >> PAGE_SHIFT;
+	partial = (start << PAGE_SHIFT) < size;
 
 	/*
 	 * Complain if there are pages in the truncated region.
@@ -554,8 +554,8 @@ int osc_punch_start(const struct lu_env *env, struct cl_io *io,
 		    struct cl_object *obj)
 {
 	struct osc_object *osc = cl2osc(obj);
-	pgoff_t pg_start = cl_index(obj, io->u.ci_setattr.sa_falloc_offset);
-	pgoff_t pg_end = cl_index(obj, io->u.ci_setattr.sa_falloc_end - 1);
+	pgoff_t pg_start = io->u.ci_setattr.sa_falloc_offset >> PAGE_SHIFT;
+	pgoff_t pg_end = (io->u.ci_setattr.sa_falloc_end - 1) >> PAGE_SHIFT;
 	int rc;
 
 	rc = osc_cache_writeback_range(env, osc, pg_start, pg_end, 1, 0);
@@ -944,8 +944,8 @@ int osc_io_fsync_start(const struct lu_env *env,
 	struct cl_fsync_io *fio = &io->u.ci_fsync;
 	struct cl_object *obj = slice->cis_obj;
 	struct osc_object *osc = cl2osc(obj);
-	pgoff_t start = cl_index(obj, fio->fi_start);
-	pgoff_t end = cl_index(obj, fio->fi_end);
+	pgoff_t start = fio->fi_start >> PAGE_SHIFT;
+	pgoff_t end = fio->fi_end >> PAGE_SHIFT;
 	int result = 0;
 
 	if (fio->fi_end == OBD_OBJECT_EOF)
@@ -982,8 +982,8 @@ void osc_io_fsync_end(const struct lu_env *env,
 {
 	struct cl_fsync_io *fio = &slice->cis_io->u.ci_fsync;
 	struct cl_object *obj = slice->cis_obj;
-	pgoff_t start = cl_index(obj, fio->fi_start);
-	pgoff_t end = cl_index(obj, fio->fi_end);
+	pgoff_t start = fio->fi_start >> PAGE_SHIFT;
+	pgoff_t end = fio->fi_end >> PAGE_SHIFT;
 	int result = 0;
 
 	if (fio->fi_mode == CL_FSYNC_LOCAL) {
diff --git a/fs/lustre/osc/osc_lock.c b/fs/lustre/osc/osc_lock.c
index 3b22688e0b4f..181edf286739 100644
--- a/fs/lustre/osc/osc_lock.c
+++ b/fs/lustre/osc/osc_lock.c
@@ -237,8 +237,8 @@ static void osc_lock_granted(const struct lu_env *env, struct osc_lock *oscl,
 		 * we decide whether to grant a lockless lock.
 		 */
 		descr->cld_mode = osc_ldlm2cl_lock(dlmlock->l_granted_mode);
-		descr->cld_start = cl_index(descr->cld_obj, ext->start);
-		descr->cld_end = cl_index(descr->cld_obj, ext->end);
+		descr->cld_start = ext->start >> PAGE_SHIFT;
+		descr->cld_end = ext->end >> PAGE_SHIFT;
 		descr->cld_gid = ext->gid;
 
 		/* no lvb update for matched lock */
@@ -424,8 +424,8 @@ static int __osc_dlm_blocking_ast(const struct lu_env *env,
 
 		/* Destroy pages covered by the extent of the DLM lock */
 		result = osc_lock_flush(cl2osc(obj),
-					cl_index(obj, extent->start),
-					cl_index(obj, extent->end),
+					extent->start >> PAGE_SHIFT,
+					extent->end >> PAGE_SHIFT,
 					mode, discard);
 
 		/* losing a lock, update kms */
@@ -669,11 +669,11 @@ static unsigned long osc_lock_weight(const struct lu_env *env,
 	if (result != 0)
 		return 1;
 
-	page_index = cl_index(obj, start);
+	page_index = start >> PAGE_SHIFT;
 
 	if (!osc_page_gang_lookup(env, io, oscobj,
-				 page_index, cl_index(obj, end),
-				 weigh_cb, (void *)&page_index))
+				  page_index, end >> PAGE_SHIFT,
+				  weigh_cb, (void *)&page_index))
 		result = 1;
 	cl_io_fini(env, io);
 
@@ -1157,9 +1157,9 @@ void osc_lock_set_writer(const struct lu_env *env, const struct cl_io *io,
 		return;
 
 	if (likely(io->ci_type == CIT_WRITE)) {
-		io_start = cl_index(obj, io->u.ci_rw.crw_pos);
-		io_end = cl_index(obj, io->u.ci_rw.crw_pos +
-				  io->u.ci_rw.crw_count - 1);
+		io_start = io->u.ci_rw.crw_pos >> PAGE_SHIFT;
+		io_end = (io->u.ci_rw.crw_pos +
+			  io->u.ci_rw.crw_count - 1) >> PAGE_SHIFT;
 	} else {
 		LASSERT(cl_io_is_mkwrite(io));
 		io_start = io->u.ci_fault.ft_index;
diff --git a/fs/lustre/osc/osc_page.c b/fs/lustre/osc/osc_page.c
index f700b5af7de0..d4b3baf227b6 100644
--- a/fs/lustre/osc/osc_page.c
+++ b/fs/lustre/osc/osc_page.c
@@ -111,8 +111,8 @@ void osc_index2policy(union ldlm_policy_data *policy,
 		      pgoff_t start, pgoff_t end)
 {
 	memset(policy, 0, sizeof(*policy));
-	policy->l_extent.start = cl_offset(obj, start);
-	policy->l_extent.end = cl_offset(obj, end + 1) - 1;
+	policy->l_extent.start = start << PAGE_SHIFT;
+	policy->l_extent.end = ((end + 1) << PAGE_SHIFT) - 1;
 }
 
 static int osc_page_print(const struct lu_env *env,
@@ -247,7 +247,7 @@ int osc_page_init(const struct lu_env *env, struct cl_object *obj,
 	opg->ops_to = PAGE_SIZE - 1;
 	INIT_LIST_HEAD(&opg->ops_lru);
 
-	result = osc_prep_async_page(osc, opg, cl_page, cl_offset(obj, index));
+	result = osc_prep_async_page(osc, opg, cl_page, index << PAGE_SHIFT);
 	if (result != 0)
 		return result;
 
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 10/33] lustre: csdc: reserve layout bits for compress component
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (8 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 09/33] lustre: remove cl_{offset, index, page_size} helpers James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 11/33] lustre: obd: replace simple_strtoul() James Simmons
                   ` (22 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Artem Blagodarenko, Lustre Development List

From: Bobi Jam <bobijam@whamcloud.com>

Add layout bits for compress component layout.

* lcme_compr_type: compression type (gzip, lz4, lz4hc, lzo, etc.)
* lcme_compr_lvl: compression level (0=default, 1-15)
* lcme_compr_chunk_log_bits: chunk size = 2^(16+chunk_log_bits)

Component pattern:
* LOV_PATTERN_COMPRESS - file contains compressed data chunks and
        cannot be read by a client without decompression support.

Compress component flags:
* LCME_FL_COMPRESS - the component should be compressed with the
        compression algorithm stored in lcme_comp_type, at level
        lcme_comp_level, with chunk size 2^(16+lcme_chunk_log_bits)
* LCME_FL_PARTIAL - the component holds some uncompressed chunks due
        to poor write size/alignment, and may benefit from being
        recompressed as the full file data is available
* LCME_FL_NOCOMPR - the component should not be compressed because
        the data was found to be incompressible, or by user request

WC-bug-id: https://jira.whamcloud.com/browse/LU-10026
Lustre-commit: 570d76dc3fd677357 ("LU-10026 csdc: reserve layout bits for compress component")
Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49170
Reviewed-by: Artem Blagodarenko <ablagodarenko@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/ptlrpc/pack_generic.c         |  1 -
 fs/lustre/ptlrpc/wiretest.c             | 13 +++++++++----
 include/uapi/linux/lustre/lustre_user.h | 17 ++++++++++++++++-
 3 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/fs/lustre/ptlrpc/pack_generic.c b/fs/lustre/ptlrpc/pack_generic.c
index 16058b9cd9be..61fd122e8e3f 100644
--- a/fs/lustre/ptlrpc/pack_generic.c
+++ b/fs/lustre/ptlrpc/pack_generic.c
@@ -2299,7 +2299,6 @@ void lustre_swab_lov_comp_md_v1(struct lov_comp_md_v1 *lum)
 		__swab32s(&ent->lcme_layout_gen);
 		/* no need to swab lcme_dstripe_count */
 		/* no need to swab lcme_cstripe_count */
-		BUILD_BUG_ON(offsetof(typeof(*ent), lcme_padding_1) == 0);
 
 		v1 = (struct lov_user_md_v1 *)((char *)lum + off);
 		stripe_count = v1->lmm_stripe_count;
diff --git a/fs/lustre/ptlrpc/wiretest.c b/fs/lustre/ptlrpc/wiretest.c
index e336410a6ed1..45adb33a9c56 100644
--- a/fs/lustre/ptlrpc/wiretest.c
+++ b/fs/lustre/ptlrpc/wiretest.c
@@ -1676,10 +1676,10 @@ void lustre_assert_wire_constants(void)
 		 (long long)(int)offsetof(struct lov_comp_md_entry_v1, lcme_cstripe_count));
 	LASSERTF((int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_cstripe_count) == 1, "found %lld\n",
 		 (long long)(int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_cstripe_count));
-	LASSERTF((int)offsetof(struct lov_comp_md_entry_v1, lcme_padding_1) == 46, "found %lld\n",
-		 (long long)(int)offsetof(struct lov_comp_md_entry_v1, lcme_padding_1));
-	LASSERTF((int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_padding_1) == 2, "found %lld\n",
-		 (long long)(int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_padding_1));
+	LASSERTF((int)offsetof(struct lov_comp_md_entry_v1, lcme_compr_type) == 46, "found %lld\n",
+		 (long long)(int)offsetof(struct lov_comp_md_entry_v1, lcme_compr_type));
+	LASSERTF((int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_compr_type) == 1, "found %lld\n",
+		 (long long)(int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_compr_type));
 	BUILD_BUG_ON(LCME_FL_STALE != 0x00000001);
 	BUILD_BUG_ON(LCME_FL_PREF_RD != 0x00000002);
 	BUILD_BUG_ON(LCME_FL_PREF_WR != 0x00000004);
@@ -1689,6 +1689,9 @@ void lustre_assert_wire_constants(void)
 	BUILD_BUG_ON(LCME_FL_NOSYNC != 0x00000020);
 	BUILD_BUG_ON(LCME_FL_EXTENSION != 0x00000040);
 	BUILD_BUG_ON(LCME_FL_PARITY != 0x00000080);
+	BUILD_BUG_ON(LCME_FL_COMPRESS != 0x00000100);
+	BUILD_BUG_ON(LCME_FL_PARTIAL != 0x00000200);
+	BUILD_BUG_ON(LCME_FL_NOCOMPR != 0x00000400);
 	BUILD_BUG_ON(LCME_FL_NEG != 0x80000000);
 
 	/* Checks for struct lov_comp_md_v1 */
@@ -1749,6 +1752,8 @@ void lustre_assert_wire_constants(void)
 		 (long long)LCM_FL_SYNC_PENDING);
 	LASSERTF(LCM_FL_PCC_RDONLY == 8, "found %lld\n",
 		 (long long)LCM_FL_PCC_RDONLY);
+	LASSERTF(LCM_FL_FLR_MASK == 11, "found %lld\n",
+		 (long long)LCM_FL_FLR_MASK);
 
 	/* Checks for struct lmv_mds_md_v1 */
 	LASSERTF((int)sizeof(struct lmv_mds_md_v1) == 56, "found %lld\n",
diff --git a/include/uapi/linux/lustre/lustre_user.h b/include/uapi/linux/lustre/lustre_user.h
index 7ee79e21e8ef..8f648ecd91fa 100644
--- a/include/uapi/linux/lustre/lustre_user.h
+++ b/include/uapi/linux/lustre/lustre_user.h
@@ -425,6 +425,7 @@ struct ll_ioc_lease_id {
 #define LOV_PATTERN_MDT			0x100
 #define LOV_PATTERN_OVERSTRIPING	0x200
 #define LOV_PATTERN_FOREIGN		0x400
+#define LOV_PATTERN_COMPRESS		0x800
 
 #define LOV_PATTERN_F_MASK	0xffff0000
 #define LOV_PATTERN_F_HOLE	0x40000000 /* there is hole in LOV EA */
@@ -586,6 +587,15 @@ enum lov_comp_md_entry_flags {
 	LCME_FL_NOSYNC		= 0x00000020,	/* FLR: no sync for the mirror */
 	LCME_FL_EXTENSION	= 0x00000040,	/* extension comp, never init */
 	LCME_FL_PARITY		= 0x00000080,	/* EC: a parity code component */
+	LCME_FL_COMPRESS	= 0x00000100,	/* the component should be
+						 * compressed
+						 */
+	LCME_FL_PARTIAL		= 0x00000200,	/* some chunks in the component
+						 * are uncompressed
+						 */
+	LCME_FL_NOCOMPR		= 0x00000400,	/* the component should not be
+						 * compressed
+						 */
 	LCME_FL_NEG		= 0x80000000,	/* used to indicate a negative
 						 * flag, won't be stored on disk
 						 */
@@ -640,7 +650,12 @@ struct lov_comp_md_entry_v1 {
 	__u8			lcme_cstripe_count;	/* code stripe count,
 							 * p value in EC
 							 */
-	__u16			lcme_padding_1;
+	__u8			lcme_compr_type;	/* compress type */
+	__u8			lcme_compr_lvl:4;	/* compress level */
+	__u8			lcme_compr_chunk_log_bits:4;
+				     /* chunk_size = 2^(16+chunk_log_bits)
+				      * i.e. power-of-two multiple of 64KiB
+				      */
 } __attribute__((packed));
 
 #define SEQ_ID_MAX		0x0000FFFF
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 11/33] lustre: obd: replace simple_strtoul()
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (9 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 10/33] lustre: csdc: reserve layout bits for compress component James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 12/33] lnet: Use dynamic allocation for LND tunables James Simmons
                   ` (21 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Arshad Hussain, Lustre Development List

Replace the use of simple_strtoul() in filename_is_volatile() with
sscanf(). This change also strengthens the checking of the format
of the volatile file's name.

WC-bug-id: https://jira.whamcloud.com/browse/LU-9325
Lustre-commit: 79b34a83f811f5f1d ("LU-9325 obd: replace simple_strtoul()")
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49910
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
---
 fs/lustre/include/obd.h | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/fs/lustre/include/obd.h b/fs/lustre/include/obd.h
index 174372001b23..c62d9171150a 100644
--- a/fs/lustre/include/obd.h
+++ b/fs/lustre/include/obd.h
@@ -1219,7 +1219,7 @@ static inline bool filename_is_volatile(const char *name, size_t namelen,
 					int *idx)
 {
 	const char *start;
-	char *end;
+	int rnd, fd, rc;
 
 	if (strncmp(name, LUSTRE_VOLATILE_HDR, LUSTRE_VOLATILE_HDR_LEN) != 0)
 		return false;
@@ -1241,12 +1241,11 @@ static inline bool filename_is_volatile(const char *name, size_t namelen,
 	}
 	/* we have an idx, read it */
 	start = name + LUSTRE_VOLATILE_HDR_LEN + 1;
-	*idx = simple_strtoul(start, &end, 0);
-	/* error cases:
-	 * no digit, no trailing :, negative value
+	rc = sscanf(start, "%4x:%4x:fd=%2d", idx, &rnd, &fd);
+	/* error cases: no digit or negative value
+	 * rc will never be larger then 3
 	 */
-	if (((*idx == 0) && (end == start)) ||
-	    (*end != ':') || (*idx < 0))
+	if (rc <= 0 || *idx < 0)
 		goto bad_format;
 
 	return true;
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 12/33] lnet: Use dynamic allocation for LND tunables
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (10 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 11/33] lustre: obd: replace simple_strtoul() James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 13/33] lustre: cksum: fix generating T10PI guard tags for partial brw page James Simmons
                   ` (20 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Chris Horn, Serguei Smirnov, Lustre Development List

From: Chris Horn <chris.horn@hpe.com>

Increasing size of lnet_ioctl_config_lnd_tunables can cause us to
trip Werror=frame-larger-than warning in lnet_net_cmd() and its
call to static function lnet_genl_parse_local_ni(). Dynamically
allocate this memory instead.

WC-bug-id: https://jira.whamcloud.com/browse/LU-16801
Lustre-commit: fe2e85e5c312a6a10 ("LU-16801 lnet: Use dynamic allocation for LND tunables")
Signed-off-by: Chris Horn <chris.horn@hpe.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50872
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 net/lnet/lnet/api-ni.c | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/net/lnet/lnet/api-ni.c b/net/lnet/lnet/api-ni.c
index 5ec6faa2da98..585148b4b6aa 100644
--- a/net/lnet/lnet/api-ni.c
+++ b/net/lnet/lnet/api-ni.c
@@ -4973,16 +4973,22 @@ lnet_genl_parse_local_ni(struct nlattr *entry, struct genl_info *info,
 			 bool *ni_list)
 {
 	bool create = info->nlhdr->nlmsg_flags & NLM_F_CREATE;
-	struct lnet_ioctl_config_lnd_tunables tun;
+	struct lnet_ioctl_config_lnd_tunables *tun;
 	struct nlattr *settings;
 	int rem3, rc = 0;
 
-	memset(&tun, 0, sizeof(tun));
+	tun = kzalloc(sizeof(*tun), GFP_KERNEL);
+	if (!tun) {
+		GENL_SET_ERR_MSG(info, "cannot allocate memory for tunables");
+		rc = -ENOMEM;
+		goto out;
+	}
+
 	/* Use LND defaults */
-	tun.lt_cmn.lct_peer_timeout = -1;
-	tun.lt_cmn.lct_peer_tx_credits = -1;
-	tun.lt_cmn.lct_peer_rtr_credits = -1;
-	tun.lt_cmn.lct_max_tx_credits = -1;
+	tun->lt_cmn.lct_peer_timeout = -1;
+	tun->lt_cmn.lct_peer_tx_credits = -1;
+	tun->lt_cmn.lct_peer_rtr_credits = -1;
+	tun->lt_cmn.lct_max_tx_credits = -1;
 	conf->lic_ncpts = 0;
 
 	nla_for_each_nested(settings, entry, rem3) {
@@ -5031,7 +5037,7 @@ lnet_genl_parse_local_ni(struct nlattr *entry, struct genl_info *info,
 				goto out;
 			}
 
-			rc = lnet_genl_parse_tunables(settings, &tun);
+			rc = lnet_genl_parse_tunables(settings, tun);
 			if (rc < 0) {
 				GENL_SET_ERR_MSG(info,
 						 "failed to parse tunables");
@@ -5058,7 +5064,7 @@ lnet_genl_parse_local_ni(struct nlattr *entry, struct genl_info *info,
 			}
 
 			rc = lnet_genl_parse_lnd_tunables(settings,
-							  &tun.lt_tun, lnd);
+							  &tun->lt_tun, lnd);
 			if (rc < 0) {
 				GENL_SET_ERR_MSG(info,
 						 "failed to parse lnd tunables");
@@ -5150,7 +5156,7 @@ lnet_genl_parse_local_ni(struct nlattr *entry, struct genl_info *info,
 			goto out;
 		}
 
-		rc = lnet_dyn_add_ni(conf, net_id, &tun);
+		rc = lnet_dyn_add_ni(conf, net_id, tun);
 		switch (rc) {
 		case -ENOENT:
 			GENL_SET_ERR_MSG(info,
@@ -5168,6 +5174,8 @@ lnet_genl_parse_local_ni(struct nlattr *entry, struct genl_info *info,
 		}
 	}
 out:
+	kfree(tun);
+
 	return rc;
 }
 
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 13/33] lustre: cksum: fix generating T10PI guard tags for partial brw page
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (11 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 12/33] lnet: Use dynamic allocation for LND tunables James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 14/33] lustre: llite: remove OBD_ -> CFS_ macros James Simmons
                   ` (19 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Li Xi, Li Dongyang, Lustre Development List

From: Li Dongyang <dongyangli@ddn.com>

To get better performance, we allocate a page as the buffer for
T10PI guard tags, we fill the buffer going over every page for brw,
when the buffer is considered full, we use
cfs_crypto_hash_update_page() to update the hash and reuse the buffer.

It doesn't work when there's a page in the brw gets clipped, and the
checksum sector size is 512. For a page with PAGE_SIZE of 4096,
and offset at 1024, we will end up with 6 guard tags, and won't have
enough space in the very end of the buffer for a full brw page, which
needs 8.

Work out the number of guard tags for each page, update the
checksum hash and reuse the buffer when needed.

Fixes: 7c06498be70 ("lustre: osc: add T10PI support for RPC checksum")
WC-bug-id: https://jira.whamcloud.com/browse/LU-16712
Lustre-commit: 3999627447c01eebd ("LU-16712 cksum: fix generating T10PI guard tags for partial brw page")
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50540
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Li Xi <lixi@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/osc/osc_request.c | 44 +++++++++++++++++++++----------------
 1 file changed, 25 insertions(+), 19 deletions(-)

diff --git a/fs/lustre/osc/osc_request.c b/fs/lustre/osc/osc_request.c
index 061767503401..582cd96c304b 100644
--- a/fs/lustre/osc/osc_request.c
+++ b/fs/lustre/osc/osc_request.c
@@ -1197,12 +1197,12 @@ static int osc_checksum_bulk_t10pi(const char *obd_name, int nob,
 	struct page *__page;
 	unsigned char *buffer;
 	__be16 *guard_start;
-	unsigned int bufsize;
 	int guard_number;
 	int used_number = 0;
 	int used;
 	u32 cksum;
-	int rc = 0;
+	unsigned int bufsize = sizeof(cksum);
+	int rc = 0, rc2;
 	int i = 0;
 
 	LASSERT(pg_count > 0);
@@ -1228,6 +1228,15 @@ static int osc_checksum_bulk_t10pi(const char *obd_name, int nob,
 
 	while (nob > 0 && pg_count > 0) {
 		unsigned int count = pga[i]->count > nob ? nob : pga[i]->count;
+		int off = pga[i]->off & ~PAGE_MASK;
+		int guards_needed = DIV_ROUND_UP(off + count, sector_size) -
+				    (off / sector_size);
+
+		if (guards_needed > guard_number - used_number) {
+			cfs_crypto_hash_update_page(hdesc, __page, 0,
+						    used_number * sizeof(*guard_start));
+			used_number = 0;
+		}
 
 		/* corrupt the data before we compute the checksum, to
 		 * simulate an OST->client data error
@@ -1235,7 +1244,6 @@ static int osc_checksum_bulk_t10pi(const char *obd_name, int nob,
 		if (unlikely(i == 0 && opc == OST_READ &&
 			     OBD_FAIL_CHECK(OBD_FAIL_OSC_CHECKSUM_RECEIVE))) {
 			unsigned char *ptr = kmap(pga[i]->pg);
-			int off = pga[i]->off & ~PAGE_MASK;
 
 			memcpy(ptr + off, "bad1", min_t(typeof(nob), 4, nob));
 			kunmap(pga[i]->pg);
@@ -1262,34 +1270,32 @@ static int osc_checksum_bulk_t10pi(const char *obd_name, int nob,
 			break;
 
 		used_number += used;
-		if (used_number == guard_number) {
-			cfs_crypto_hash_update_page(hdesc, __page, 0,
-				used_number * sizeof(*guard_start));
-			used_number = 0;
-		}
-
 		nob -= pga[i]->count;
 		pg_count--;
 		i++;
 	}
 	kunmap(__page);
 	if (rc)
-		goto out;
+		goto out_hash;
 
 	if (used_number != 0)
 		cfs_crypto_hash_update_page(hdesc, __page, 0,
 			used_number * sizeof(*guard_start));
 
-	bufsize = sizeof(cksum);
-	cfs_crypto_hash_final(hdesc, (unsigned char *)&cksum, &bufsize);
-
-	/* For sending we only compute the wrong checksum instead
-	 * of corrupting the data so it is still correct on a redo
-	 */
-	if (opc == OST_WRITE && OBD_FAIL_CHECK(OBD_FAIL_OSC_CHECKSUM_SEND))
-		cksum++;
+out_hash:
+	rc2 = cfs_crypto_hash_final(hdesc, (unsigned char *)&cksum, &bufsize);
+	if (!rc)
+		rc = rc2;
+	if (rc == 0) {
+		/* For sending we only compute the wrong checksum instead
+		 * of corrupting the data so it is still correct on a redo
+		 */
+		if (opc == OST_WRITE &&
+		    OBD_FAIL_CHECK(OBD_FAIL_OSC_CHECKSUM_SEND))
+			cksum++;
 
-	*check_sum = cksum;
+		*check_sum = cksum;
+	}
 out:
 	__free_page(__page);
 	return rc;
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 14/33] lustre: llite: remove OBD_ -> CFS_ macros
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (12 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 13/33] lustre: cksum: fix generating T10PI guard tags for partial brw page James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 15/33] lustre: obd: " James Simmons
                   ` (18 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Arshad Hussain, Lustre Development List

From: Timothy Day <timday@amazon.com>

Remove OBD macros that are simply redefinitions
of CFS macros.

WC-bug-id: https://jira.whamcloud.com/browse/LU-12610
Lustre-commit: 407d34a639c93dc3b ("LU-12610 llite: remove OBD_ -> CFS_ macros")
Signed-off-by: Timothy Day <timday@amazon.com>
Signed-off-by: Ben Evans <beevans@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50804
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/llite/dir.c         |  2 +-
 fs/lustre/llite/file.c        |  8 ++++----
 fs/lustre/llite/glimpse.c     |  2 +-
 fs/lustre/llite/llite_lib.c   | 10 +++++-----
 fs/lustre/llite/namei.c       |  6 +++---
 fs/lustre/llite/pcc.c         |  8 ++++----
 fs/lustre/llite/rw.c          |  4 ++--
 fs/lustre/llite/rw26.c        |  4 ++--
 fs/lustre/llite/vvp_io.c      |  8 ++++----
 fs/lustre/llite/vvp_object.c  |  2 +-
 fs/lustre/llite/xattr_cache.c |  2 +-
 fs/lustre/lmv/lmv_obd.c       |  2 +-
 fs/lustre/lov/lov_object.c    |  2 +-
 13 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/fs/lustre/llite/dir.c b/fs/lustre/llite/dir.c
index 98da2c95ca37..0f4dc2f1ce5e 100644
--- a/fs/lustre/llite/dir.c
+++ b/fs/lustre/llite/dir.c
@@ -462,7 +462,7 @@ static int ll_dir_setdirstripe(struct dentry *dparent, struct lmv_user_md *lump,
 		return -EINVAL;
 
 	if (IS_DEADDIR(parent) &&
-	    !OBD_FAIL_CHECK(OBD_FAIL_LLITE_NO_CHECK_DEAD))
+	    !CFS_FAIL_CHECK(OBD_FAIL_LLITE_NO_CHECK_DEAD))
 		return -ENOENT;
 
 	/* MDS < 2.14 doesn't support 'crush' hash type, and cannot handle
diff --git a/fs/lustre/llite/file.c b/fs/lustre/llite/file.c
index e5bbe35de473..84c204e5f9ee 100644
--- a/fs/lustre/llite/file.c
+++ b/fs/lustre/llite/file.c
@@ -620,7 +620,7 @@ static int ll_intent_file_open(struct dentry *de, void *lmm, int lmmsize,
 	 * if server supports open-by-fid, or file name is invalid, don't pack
 	 * name in open request
 	 */
-	if (OBD_FAIL_CHECK(OBD_FAIL_LLITE_OPEN_BY_NAME) ||
+	if (CFS_FAIL_CHECK(OBD_FAIL_LLITE_OPEN_BY_NAME) ||
 	    !(exp_connect_flags(sbi->ll_md_exp) & OBD_CONNECT_OPEN_BY_FID)) {
 retry:
 		len = de->d_name.len;
@@ -654,7 +654,7 @@ static int ll_intent_file_open(struct dentry *de, void *lmm, int lmmsize,
 	op_data->op_data = lmm;
 	op_data->op_data_size = lmmsize;
 
-	OBD_FAIL_TIMEOUT(OBD_FAIL_LLITE_OPEN_DELAY, cfs_fail_val);
+	CFS_FAIL_TIMEOUT(OBD_FAIL_LLITE_OPEN_DELAY, cfs_fail_val);
 
 	rc = md_intent_lock(sbi->ll_md_exp, op_data, itp, &req,
 			    &ll_md_blocking_ast, 0);
@@ -1454,7 +1454,7 @@ static int ll_merge_attr_nolock(const struct lu_env *env, struct inode *inode)
 	ctime = inode->i_ctime.tv_sec;
 
 	cl_object_attr_lock(obj);
-	if (OBD_FAIL_CHECK(OBD_FAIL_MDC_MERGE))
+	if (CFS_FAIL_CHECK(OBD_FAIL_MDC_MERGE))
 		rc = -EINVAL;
 	else
 		rc = cl_object_attr_get(env, obj, attr);
@@ -5454,7 +5454,7 @@ int ll_getattr_dentry(struct dentry *de, struct kstat *stat, u32 request_mask,
 	}
 
 fill_attr:
-	OBD_FAIL_TIMEOUT(OBD_FAIL_GETATTR_DELAY, 30);
+	CFS_FAIL_TIMEOUT(OBD_FAIL_GETATTR_DELAY, 30);
 
 	stat->dev = inode->i_sb->s_dev;
 	if (ll_need_32bit_api(sbi)) {
diff --git a/fs/lustre/llite/glimpse.c b/fs/lustre/llite/glimpse.c
index 0190cb52f875..1579fa18bc06 100644
--- a/fs/lustre/llite/glimpse.c
+++ b/fs/lustre/llite/glimpse.c
@@ -215,7 +215,7 @@ int __cl_glimpse_size(struct inode *inode, int agl)
 				io->ci_need_restart = 1;
 		}
 
-		OBD_FAIL_TIMEOUT(OBD_FAIL_GLIMPSE_DELAY, 2);
+		CFS_FAIL_TIMEOUT(OBD_FAIL_GLIMPSE_DELAY, cfs_fail_val ? : 4);
 		cl_io_fini(env, io);
 	} while (unlikely(io->ci_need_restart));
 
diff --git a/fs/lustre/llite/llite_lib.c b/fs/lustre/llite/llite_lib.c
index 908ca3d43ee3..7efa5b0246b8 100644
--- a/fs/lustre/llite/llite_lib.c
+++ b/fs/lustre/llite/llite_lib.c
@@ -334,7 +334,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt)
 
 	data->ocd_cksum_types = obd_cksum_types_supported_client();
 
-	if (OBD_FAIL_CHECK(OBD_FAIL_MDC_LIGHTWEIGHT))
+	if (CFS_FAIL_CHECK(OBD_FAIL_MDC_LIGHTWEIGHT))
 		/* flag mdc connection as lightweight, only used for test
 		 * purpose, use with care
 		 */
@@ -563,7 +563,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt)
 				   OBD_CONNECT2_INC_XID | OBD_CONNECT2_LSEEK |
 				   OBD_CONNECT2_REP_MBITS;
 
-	if (!OBD_FAIL_CHECK(OBD_FAIL_OSC_CONNECT_GRANT_PARAM))
+	if (!CFS_FAIL_CHECK(OBD_FAIL_OSC_CONNECT_GRANT_PARAM))
 		data->ocd_connect_flags |= OBD_CONNECT_GRANT_PARAM;
 
 	/* OBD_CONNECT_CKSUM should always be set, even if checksums are
@@ -573,7 +573,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt)
 	 */
 	data->ocd_connect_flags |= OBD_CONNECT_CKSUM;
 
-	if (OBD_FAIL_CHECK(OBD_FAIL_OSC_CKSUM_ADLER_ONLY))
+	if (CFS_FAIL_CHECK(OBD_FAIL_OSC_CKSUM_ADLER_ONLY))
 		data->ocd_cksum_types = OBD_CKSUM_ADLER;
 	else
 		data->ocd_cksum_types = obd_cksum_types_supported_client();
@@ -1241,7 +1241,7 @@ int ll_fill_super(struct super_block *sb)
 
 	CDEBUG(D_VFSTRACE, "VFS Op: sb %p\n", sb);
 
-	OBD_RACE(OBD_FAIL_LLITE_RACE_MOUNT);
+	CFS_RACE(OBD_FAIL_LLITE_RACE_MOUNT);
 
 	cfg = kzalloc(sizeof(*cfg), GFP_NOFS);
 	if (!cfg) {
@@ -1429,7 +1429,7 @@ void ll_put_super(struct super_block *sb)
 	}
 
 	/* imitate failed cleanup */
-	if (OBD_FAIL_CHECK(OBD_FAIL_OBD_CLEANUP))
+	if (CFS_FAIL_CHECK(OBD_FAIL_OBD_CLEANUP))
 		goto skip_cleanup;
 
 	next = 0;
diff --git a/fs/lustre/llite/namei.c b/fs/lustre/llite/namei.c
index 59a7bbb7a99f..85a5902b0598 100644
--- a/fs/lustre/llite/namei.c
+++ b/fs/lustre/llite/namei.c
@@ -204,7 +204,7 @@ static int ll_dom_lock_cancel(struct inode *inode, struct ldlm_lock *lock)
 	if (IS_ERR(env))
 		return PTR_ERR(env);
 
-	OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_REPLAY_PAUSE, cfs_fail_val);
+	CFS_FAIL_TIMEOUT(OBD_FAIL_LDLM_REPLAY_PAUSE, cfs_fail_val);
 
 	/* reach MDC layer to flush data under  the DoM ldlm lock */
 	rc = cl_object_flush(env, lli->lli_clob, lock);
@@ -1213,7 +1213,7 @@ static int ll_atomic_open(struct inode *dir, struct dentry *dentry,
 		}
 	}
 
-	OBD_FAIL_TIMEOUT(OBD_FAIL_LLITE_CREATE_FILE_PAUSE2, cfs_fail_val);
+	CFS_FAIL_TIMEOUT(OBD_FAIL_LLITE_CREATE_FILE_PAUSE2, cfs_fail_val);
 
 	/* We can only arrive at this path when we have no inode, so
 	 * we only need to request open lock if it was requested
@@ -1340,7 +1340,7 @@ static struct inode *ll_create_node(struct inode *dir, struct lookup_intent *it)
 	}
 
 	/* Pause to allow for a race with concurrent access by fid */
-	OBD_FAIL_TIMEOUT(OBD_FAIL_LLITE_CREATE_NODE_PAUSE, cfs_fail_val);
+	CFS_FAIL_TIMEOUT(OBD_FAIL_LLITE_CREATE_NODE_PAUSE, cfs_fail_val);
 
 	/* We asked for a lock on the directory, but were granted a
 	 * lock on the inode.  Since we finally have an inode pointer,
diff --git a/fs/lustre/llite/pcc.c b/fs/lustre/llite/pcc.c
index ec35061052b2..ac9124f9554e 100644
--- a/fs/lustre/llite/pcc.c
+++ b/fs/lustre/llite/pcc.c
@@ -1674,7 +1674,7 @@ ssize_t pcc_file_write_iter(struct kiocb *iocb,
 	if (!*cached)
 		return 0;
 
-	if (OBD_FAIL_CHECK(OBD_FAIL_LLITE_PCC_FAKE_ERROR)) {
+	if (CFS_FAIL_CHECK(OBD_FAIL_LLITE_PCC_FAKE_ERROR)) {
 		result = -ENOSPC;
 		goto out;
 	}
@@ -1911,7 +1911,7 @@ vm_fault_t pcc_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
 		return VM_FAULT_RETRY | VM_FAULT_NOPAGE;
 	}
 	/* Pause to allow for a race with concurrent detach */
-	OBD_FAIL_TIMEOUT(OBD_FAIL_LLITE_PCC_MKWRITE_PAUSE, cfs_fail_val);
+	CFS_FAIL_TIMEOUT(OBD_FAIL_LLITE_PCC_MKWRITE_PAUSE, cfs_fail_val);
 
 	pcc_io_init(inode, PIT_PAGE_MKWRITE, cached);
 	if (!*cached) {
@@ -1944,7 +1944,7 @@ vm_fault_t pcc_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
 	 * This fault injection can also be used to simulate -ENOSPC and
 	 * -EDQUOT failure of underlying PCC backend fs.
 	 */
-	if (OBD_FAIL_CHECK(OBD_FAIL_LLITE_PCC_DETACH_MKWRITE)) {
+	if (CFS_FAIL_CHECK(OBD_FAIL_LLITE_PCC_DETACH_MKWRITE)) {
 		pcc_io_fini(inode);
 		pcc_ioctl_detach(inode, PCC_DETACH_OPT_UNCACHE);
 		mmap_read_unlock(mm);
@@ -2401,7 +2401,7 @@ int pcc_readwrite_attach(struct file *file, struct inode *inode,
 		goto out_fput;
 
 	/* Pause to allow for a race with concurrent HSM remove */
-	OBD_FAIL_TIMEOUT(OBD_FAIL_LLITE_PCC_ATTACH_PAUSE, cfs_fail_val);
+	CFS_FAIL_TIMEOUT(OBD_FAIL_LLITE_PCC_ATTACH_PAUSE, cfs_fail_val);
 
 	pcc_inode_lock(inode);
 	pcci = ll_i2pcci(inode);
diff --git a/fs/lustre/llite/rw.c b/fs/lustre/llite/rw.c
index c7adfc6d4faf..d2e400182ecf 100644
--- a/fs/lustre/llite/rw.c
+++ b/fs/lustre/llite/rw.c
@@ -1875,9 +1875,9 @@ int ll_readpage(struct file *file, struct page *vmpage)
 	struct cl_page *page;
 	int result;
 
-	if (OBD_FAIL_PRECHECK(OBD_FAIL_LLITE_READPAGE_PAUSE)) {
+	if (CFS_FAIL_PRECHECK(OBD_FAIL_LLITE_READPAGE_PAUSE)) {
 		unlock_page(vmpage);
-		OBD_FAIL_TIMEOUT(OBD_FAIL_LLITE_READPAGE_PAUSE, cfs_fail_val);
+		CFS_FAIL_TIMEOUT(OBD_FAIL_LLITE_READPAGE_PAUSE, cfs_fail_val);
 		lock_page(vmpage);
 	}
 
diff --git a/fs/lustre/llite/rw26.c b/fs/lustre/llite/rw26.c
index 5f0186cb9ecb..ad7308a8c902 100644
--- a/fs/lustre/llite/rw26.c
+++ b/fs/lustre/llite/rw26.c
@@ -97,9 +97,9 @@ static void ll_invalidatepage(struct page *vmpage, unsigned int offset,
 		cl_env_percpu_put(env);
 	}
 
-	if (OBD_FAIL_PRECHECK(OBD_FAIL_LLITE_PAGE_INVALIDATE_PAUSE)) {
+	if (CFS_FAIL_PRECHECK(OBD_FAIL_LLITE_PAGE_INVALIDATE_PAUSE)) {
 		unlock_page(vmpage);
-		OBD_FAIL_TIMEOUT(OBD_FAIL_LLITE_PAGE_INVALIDATE_PAUSE,
+		CFS_FAIL_TIMEOUT(OBD_FAIL_LLITE_PAGE_INVALIDATE_PAUSE,
 				 cfs_fail_val);
 		lock_page(vmpage);
 	}
diff --git a/fs/lustre/llite/vvp_io.c b/fs/lustre/llite/vvp_io.c
index 1b5628d1502d..c5f479c6f7e2 100644
--- a/fs/lustre/llite/vvp_io.c
+++ b/fs/lustre/llite/vvp_io.c
@@ -76,7 +76,7 @@ static bool can_populate_pages(const struct lu_env *env, struct cl_io *io,
 		 * extent lock and GROUP lock has to hold to swap layout
 		 */
 		if (ll_layout_version_get(lli) != vio->vui_layout_gen ||
-		    OBD_FAIL_CHECK_RESET(OBD_FAIL_LLITE_LOST_LAYOUT, 0)) {
+		    CFS_FAIL_CHECK_RESET(OBD_FAIL_LLITE_LOST_LAYOUT, 0)) {
 			io->ci_need_restart = 1;
 			/* this will cause a short read/write */
 			io->ci_continue = 0;
@@ -1230,10 +1230,10 @@ static int vvp_io_write_start(const struct lu_env *env,
 	}
 
 	/* Tests to verify we take the i_mutex correctly */
-	if (OBD_FAIL_CHECK(OBD_FAIL_LLITE_IMUTEX_SEC) && !lock_inode)
+	if (CFS_FAIL_CHECK(OBD_FAIL_LLITE_IMUTEX_SEC) && !lock_inode)
 		return -EINVAL;
 
-	if (OBD_FAIL_CHECK(OBD_FAIL_LLITE_IMUTEX_NOSEC) && lock_inode)
+	if (CFS_FAIL_CHECK(OBD_FAIL_LLITE_IMUTEX_NOSEC) && lock_inode)
 		return -EINVAL;
 
 	if (!(file->f_flags & O_DIRECT)) {
@@ -1423,7 +1423,7 @@ static int vvp_io_fault_start(const struct lu_env *env,
 	vmpage = cfio->ft_vmpage;
 	LASSERT(PageLocked(vmpage));
 
-	if (OBD_FAIL_CHECK(OBD_FAIL_LLITE_FAULT_TRUNC_RACE))
+	if (CFS_FAIL_CHECK(OBD_FAIL_LLITE_FAULT_TRUNC_RACE))
 		generic_error_remove_page(vmpage->mapping, vmpage);
 
 	size = i_size_read(inode);
diff --git a/fs/lustre/llite/vvp_object.c b/fs/lustre/llite/vvp_object.c
index c79bc5c0e6c9..5120ec095862 100644
--- a/fs/lustre/llite/vvp_object.c
+++ b/fs/lustre/llite/vvp_object.c
@@ -215,7 +215,7 @@ static void vvp_req_attr_set(const struct lu_env *env, struct cl_object *obj,
 	}
 	obdo_from_inode(oa, inode, valid_flags & attr->cra_flags);
 	obdo_set_parent_fid(oa, &ll_i2info(inode)->lli_fid);
-	if (OBD_FAIL_CHECK(OBD_FAIL_LFSCK_INVALID_PFID))
+	if (CFS_FAIL_CHECK(OBD_FAIL_LFSCK_INVALID_PFID))
 		oa->o_parent_oid++;
 
 	attr->cra_uid = lli->lli_uid;
diff --git a/fs/lustre/llite/xattr_cache.c b/fs/lustre/llite/xattr_cache.c
index d8ddb90f2042..719dfda0a8a6 100644
--- a/fs/lustre/llite/xattr_cache.c
+++ b/fs/lustre/llite/xattr_cache.c
@@ -454,7 +454,7 @@ static int ll_xattr_cache_refill(struct inode *inode)
 		} else if (xval + *xsizes > xvtail) {
 			CERROR("xattr protocol violation (vals are broken)\n");
 			rc = -EPROTO;
-		} else if (OBD_FAIL_CHECK(OBD_FAIL_LLITE_XATTR_ENOMEM)) {
+		} else if (CFS_FAIL_CHECK(OBD_FAIL_LLITE_XATTR_ENOMEM)) {
 			rc = -ENOMEM;
 		} else if (!strcmp(xdata, XATTR_NAME_ACL_ACCESS)) {
 			/* Filter out ACL ACCESS since it's cached separately */
diff --git a/fs/lustre/lmv/lmv_obd.c b/fs/lustre/lmv/lmv_obd.c
index 27345a2a65b0..27c1df26849c 100644
--- a/fs/lustre/lmv/lmv_obd.c
+++ b/fs/lustre/lmv/lmv_obd.c
@@ -1680,7 +1680,7 @@ lmv_locate_tgt_by_name(struct lmv_obd *lmv, struct lmv_stripe_md *lsm,
 		return tgt;
 	}
 
-	if (OBD_FAIL_CHECK(OBD_FAIL_LFSCK_BAD_NAME_HASH)) {
+	if (CFS_FAIL_CHECK(OBD_FAIL_LFSCK_BAD_NAME_HASH)) {
 		if (cfs_fail_val >= lsm->lsm_md_stripe_count)
 			return ERR_PTR(-EBADF);
 		oinfo = &lsm->lsm_md_oinfo[cfs_fail_val];
diff --git a/fs/lustre/lov/lov_object.c b/fs/lustre/lov/lov_object.c
index 7c20f6eae03b..bc0f0a772d1d 100644
--- a/fs/lustre/lov/lov_object.c
+++ b/fs/lustre/lov/lov_object.c
@@ -132,7 +132,7 @@ static int lov_init_sub(const struct lu_env *env, struct lov_object *lov,
 	struct cl_object_header *parent;
 	int result;
 
-	if (OBD_FAIL_CHECK(OBD_FAIL_LOV_INIT)) {
+	if (CFS_FAIL_CHECK(OBD_FAIL_LOV_INIT)) {
 		/* For sanity:test_206.
 		 * Do not leave the object in cache to avoid accessing
 		 * freed memory. This is because osc_object is referring to
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 15/33] lustre: obd: remove OBD_ -> CFS_ macros
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (13 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 14/33] lustre: llite: remove OBD_ -> CFS_ macros James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 16/33] lnet: improve numeric NID to CPT hashing James Simmons
                   ` (17 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Arshad Hussain, Lustre Development List

From: Timothy Day <timday@amazon.com>

Remove OBD macros that are simply redefinitions
of CFS macros.

WC-bug-id: https://jira.whamcloud.com/browse/LU-12610
Lustre-commit: 24ada119f28045eba ("LU-12610 obd: remove OBD_ -> CFS_ macros")
Signed-off-by: Timothy Day <timday@amazon.com>
Signed-off-by: Ben Evans <beevans@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50808
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/obdclass/cl_page.c    | 2 +-
 fs/lustre/obdclass/class_obd.c  | 2 +-
 fs/lustre/obdclass/kernelcomm.c | 2 +-
 fs/lustre/obdclass/llog_obd.c   | 2 +-
 fs/lustre/obdclass/lu_object.c  | 4 ++--
 fs/lustre/obdclass/obd_config.c | 2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/lustre/obdclass/cl_page.c b/fs/lustre/obdclass/cl_page.c
index ecfccdb2c945..479707a8366f 100644
--- a/fs/lustre/obdclass/cl_page.c
+++ b/fs/lustre/obdclass/cl_page.c
@@ -149,7 +149,7 @@ static struct cl_page *__cl_page_alloc(struct cl_object *o)
 	struct cl_page *cl_page = NULL;
 	unsigned short bufsize = cl_object_header(o)->coh_page_bufsize;
 
-	if (OBD_FAIL_CHECK(OBD_FAIL_LLITE_PAGE_ALLOC))
+	if (CFS_FAIL_CHECK(OBD_FAIL_LLITE_PAGE_ALLOC))
 		return NULL;
 
 check:
diff --git a/fs/lustre/obdclass/class_obd.c b/fs/lustre/obdclass/class_obd.c
index 3692d57fbcef..dabd40da5912 100644
--- a/fs/lustre/obdclass/class_obd.c
+++ b/fs/lustre/obdclass/class_obd.c
@@ -749,7 +749,7 @@ static int __init obdclass_init(void)
 	/* simulate a late OOM situation now to require all
 	 * alloc'ed/initialized resources to be freed
 	 */
-	if (OBD_FAIL_CHECK(OBD_FAIL_OBDCLASS_MODULE_LOAD)) {
+	if (CFS_FAIL_CHECK(OBD_FAIL_OBDCLASS_MODULE_LOAD)) {
 		/* force error to ensure module will be unloaded/cleaned */
 		err = -ENOMEM;
 		goto cleanup_all;
diff --git a/fs/lustre/obdclass/kernelcomm.c b/fs/lustre/obdclass/kernelcomm.c
index 0cf3c44a528b..dda7823e4598 100644
--- a/fs/lustre/obdclass/kernelcomm.c
+++ b/fs/lustre/obdclass/kernelcomm.c
@@ -456,7 +456,7 @@ int libcfs_kkuc_group_put(const struct obd_uuid *uuid, int group, void *payload)
 	down_write(&kg_sem);
 
 	if (unlikely(list_empty(&kkuc_groups[group])) ||
-	    unlikely(OBD_FAIL_CHECK(OBD_FAIL_MDS_HSM_CT_REGISTER_NET))) {
+	    unlikely(CFS_FAIL_CHECK(OBD_FAIL_MDS_HSM_CT_REGISTER_NET))) {
 		/* no agent have fully registered, CDT will retry */
 		up_write(&kg_sem);
 		return -EAGAIN;
diff --git a/fs/lustre/obdclass/llog_obd.c b/fs/lustre/obdclass/llog_obd.c
index 4743dc9a6abc..b1c5a9e6db9f 100644
--- a/fs/lustre/obdclass/llog_obd.c
+++ b/fs/lustre/obdclass/llog_obd.c
@@ -182,7 +182,7 @@ int llog_setup(const struct lu_env *env, struct obd_device *obd,
 	}
 
 	if (op->lop_setup) {
-		if (OBD_FAIL_CHECK(OBD_FAIL_OBD_LLOG_SETUP))
+		if (CFS_FAIL_CHECK(OBD_FAIL_OBD_LLOG_SETUP))
 			rc = -EOPNOTSUPP;
 		else
 			rc = op->lop_setup(env, obd, olg, index, disk_obd);
diff --git a/fs/lustre/obdclass/lu_object.c b/fs/lustre/obdclass/lu_object.c
index 468dd43b6151..a07890f38180 100644
--- a/fs/lustre/obdclass/lu_object.c
+++ b/fs/lustre/obdclass/lu_object.c
@@ -418,7 +418,7 @@ int lu_site_purge_objects(const struct lu_env *env, struct lu_site *s,
 	int bnr;
 	unsigned int i;
 
-	if (OBD_FAIL_CHECK(OBD_FAIL_OBD_NO_LRU))
+	if (CFS_FAIL_CHECK(OBD_FAIL_OBD_NO_LRU))
 		return 0;
 
 	/*
@@ -806,7 +806,7 @@ struct lu_object *lu_object_find_at(const struct lu_env *env,
 	 */
 	s  = dev->ld_site;
 	hs = &s->ls_obj_hash;
-	if (unlikely(OBD_FAIL_PRECHECK(OBD_FAIL_OBD_ZERO_NLINK_RACE)))
+	if (unlikely(CFS_FAIL_PRECHECK(OBD_FAIL_OBD_ZERO_NLINK_RACE)))
 		lu_site_purge(env, s, -1);
 
 	bkt = &s->ls_bkts[lu_bkt_hash(s, f)];
diff --git a/fs/lustre/obdclass/obd_config.c b/fs/lustre/obdclass/obd_config.c
index 3fe1cb6e5341..140950418e55 100644
--- a/fs/lustre/obdclass/obd_config.c
+++ b/fs/lustre/obdclass/obd_config.c
@@ -450,7 +450,7 @@ static int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg)
 	int err = 0;
 	char *flag;
 
-	OBD_RACE(OBD_FAIL_LDLM_RECOV_CLIENTS);
+	CFS_RACE(OBD_FAIL_LDLM_RECOV_CLIENTS);
 
 	if (!obd->obd_set_up) {
 		CERROR("Device %d not setup\n", obd->obd_minor);
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 16/33] lnet: improve numeric NID to CPT hashing
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (14 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 15/33] lustre: obd: " James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 17/33] lnet: libcfs: Remove unsed LASSERT_ATOMIC_* macros James Simmons
                   ` (16 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Chris Horn, Serguei Smirnov, Lustre Development List

From: Chris Horn <chris.horn@hpe.com>

Testing shows that the sum-by-multiplication of nid bytes method for
hashing a NID to a CPT does not have good distribution for gnilnd
and kfilnd NIDs. For these LNDs, use the old hash_long() method.

Also modify lustre_lnet_calc_cpt_of_nid() to ensure the specified
number of CPTs is greater than 0. This avoids a divide by zero.

HPE-bug-id: LUS-11576
WC-bug-id: https://jira.whamcloud.com/browse/LU-16797
Lustre-commit: bd12731f2f15b3903 ("LU-16797 lnet: improve numeric NID to CPT hashing")
Signed-off-by: Chris Horn <chris.horn@hpe.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50862
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 net/lnet/lnet/api-ni.c | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/net/lnet/lnet/api-ni.c b/net/lnet/lnet/api-ni.c
index 585148b4b6aa..fa42cfd99aa7 100644
--- a/net/lnet/lnet/api-ni.c
+++ b/net/lnet/lnet/api-ni.c
@@ -1532,20 +1532,31 @@ static unsigned int
 lnet_nid4_cpt_hash(lnet_nid_t nid, unsigned int number)
 {
 	u64 key = nid;
-	u64 pair_bits = 0x0001000100010001LLU;
-	u64 mask = pair_bits * 0xFF;
-	u64 pair_sum;
+	u16 lnd = LNET_NETTYP(LNET_NIDNET(nid));
+	unsigned int cpt;
 
-	/* Use (sum-by-multiplication of nid bytes) mod (number of CPTs)
-	 * to match nid to a CPT.
-	 */
-	pair_sum = (key & mask) + ((key >> 8) & mask);
-	pair_sum = (pair_sum * pair_bits) >> 48;
+	if (lnd == KFILND || lnd == GNILND) {
+		cpt = hash_long(key, LNET_CPT_BITS);
+
+		/* NB: The number of CPTs needn't be a power of 2 */
+		if (cpt >= number)
+			cpt = (key + cpt + (cpt >> 1)) % number;
+	} else {
+		u64 pair_bits = 0x0001000100010001LLU;
+		u64 mask = pair_bits * 0xFF;
+		u64 pair_sum;
+		/* For ipv4 NIDs, use (sum-by-multiplication of nid bytes) mod
+		 * (number of CPTs) to match nid to a CPT.
+		 */
+		pair_sum = (key & mask) + ((key >> 8) & mask);
+		pair_sum = (pair_sum * pair_bits) >> 48;
+		cpt = (unsigned int)(pair_sum) % number;
+	}
 
 	CDEBUG(D_NET, "Match nid %s to cpt %u\n",
-	       libcfs_nid2str(nid), (unsigned int)(pair_sum) % number);
+	       libcfs_nid2str(nid), cpt);
 
-	return (unsigned int)(pair_sum) % number;
+	return cpt;
 }
 
 unsigned int
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 17/33] lnet: libcfs: Remove unsed LASSERT_ATOMIC_* macros
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (15 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 16/33] lnet: improve numeric NID to CPT hashing James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 18/33] lustre: misc: replace obsolete ioctl numbers James Simmons
                   ` (15 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Arshad Hussain, Lustre Development List

From: Arshad Hussain <arshad.hussain@aeoncomputing.com>

This is the first up series of patchs which
replaces atomic_t with refcount_t

This patch removes unused LASSERT_ATOMIC_* macros.
There are still:
        LASSERT_ATOMIC_GT
        LASSERT_ATOMIC_GT_LT
        LASSERT_ATOMIC_ZERO
        LASSERT_ATOMIC_POS

macros being used which will be subsequently removed
in following patches. This helps in breaking up patch
logically as changes are large.

WC-bug-id: https://jira.whamcloud.com/browse/LU-16796
Lustre-commit: f875d0c714b548553 ("LU-16796 libcfs: Remove unsed LASSERT_ATOMIC_* macros")
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50870
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 include/linux/libcfs/libcfs_private.h | 44 ---------------------------
 1 file changed, 44 deletions(-)

diff --git a/include/linux/libcfs/libcfs_private.h b/include/linux/libcfs/libcfs_private.h
index 378c2a56ed67..86d135a65d81 100644
--- a/include/linux/libcfs/libcfs_private.h
+++ b/include/linux/libcfs/libcfs_private.h
@@ -112,26 +112,10 @@ int libcfs_debug_mark_buffer(const char *text);
 #define LASSERT_ATOMIC_EQ(a, v)			\
 	LASSERTF(atomic_read(a) == v, "value: %d\n", atomic_read((a)))
 
-/** assert value of @a is unequal to @v */
-#define LASSERT_ATOMIC_NE(a, v)		\
-	LASSERTF(atomic_read(a) != v, "value: %d\n", atomic_read((a)))
-
-/** assert value of @a is little than @v */
-#define LASSERT_ATOMIC_LT(a, v)		\
-	LASSERTF(atomic_read(a) < v, "value: %d\n", atomic_read((a)))
-
-/** assert value of @a is little/equal to @v */
-#define LASSERT_ATOMIC_LE(a, v)		\
-	LASSERTF(atomic_read(a) <= v, "value: %d\n", atomic_read((a)))
-
 /** assert value of @a is great than @v */
 #define LASSERT_ATOMIC_GT(a, v)		\
 	LASSERTF(atomic_read(a) > v, "value: %d\n", atomic_read((a)))
 
-/** assert value of @a is great/equal to @v */
-#define LASSERT_ATOMIC_GE(a, v)		\
-	LASSERTF(atomic_read(a) >= v, "value: %d\n", atomic_read((a)))
-
 /** assert value of @a is great than @v1 and little than @v2 */
 #define LASSERT_ATOMIC_GT_LT(a, v1, v2)				\
 do {								\
@@ -139,39 +123,11 @@ do {								\
 	LASSERTF(__v > v1 && __v < v2, "value: %d\n", __v);	\
 } while (0)
 
-/** assert value of @a is great than @v1 and little/equal to @v2 */
-#define LASSERT_ATOMIC_GT_LE(a, v1, v2)				\
-do {								\
-	int __v = atomic_read(a);				\
-	LASSERTF(__v > v1 && __v <= v2, "value: %d\n", __v);    \
-} while (0)
-
-/** assert value of @a is great/equal to @v1 and little than @v2 */
-#define LASSERT_ATOMIC_GE_LT(a, v1, v2)				\
-do {								\
-	int __v = atomic_read(a);				\
-	LASSERTF(__v >= v1 && __v < v2, "value: %d\n", __v);    \
-} while (0)
-
-/** assert value of @a is great/equal to @v1 and little/equal to @v2 */
-#define LASSERT_ATOMIC_GE_LE(a, v1, v2)				\
-do {								\
-	int __v = atomic_read(a);				\
-	LASSERTF(__v >= v1 && __v <= v2, "value: %d\n", __v);   \
-} while (0)
-
 #else /* !LASSERT_ATOMIC_ENABLED */
 
 #define LASSERT_ATOMIC_EQ(a, v)		do {} while (0)
-#define LASSERT_ATOMIC_NE(a, v)		do {} while (0)
-#define LASSERT_ATOMIC_LT(a, v)		do {} while (0)
-#define LASSERT_ATOMIC_LE(a, v)		do {} while (0)
 #define LASSERT_ATOMIC_GT(a, v)		do {} while (0)
-#define LASSERT_ATOMIC_GE(a, v)		do {} while (0)
 #define LASSERT_ATOMIC_GT_LT(a, v1, v2)	do {} while (0)
-#define LASSERT_ATOMIC_GT_LE(a, v1, v2)	do {} while (0)
-#define LASSERT_ATOMIC_GE_LT(a, v1, v2)	do {} while (0)
-#define LASSERT_ATOMIC_GE_LE(a, v1, v2)	do {} while (0)
 
 #endif /* LASSERT_ATOMIC_ENABLED */
 
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 18/33] lustre: misc: replace obsolete ioctl numbers
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (16 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 17/33] lnet: libcfs: Remove unsed LASSERT_ATOMIC_* macros James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 19/33] lustre: lmv: treat unknown hash type as sane type James Simmons
                   ` (14 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Arshad Hussain, Vitaliy Kuznetsov, Lustre Development List

From: Andreas Dilger <adilger@whamcloud.com>

Renumber the OBD_IOC_BARRIER and IOC_OSC_SET_ACTIVE ioctl numbers
to use IOC type 'f' instead of 'g' and 'h', respectively.  Add
compatibility code to handle their deprecation in the future.

Move already-deprecated ioctls OBD_IOC_GETNAME_OLD, OBD_GET_VERSION,
IOC_LIBCFS_GET_NI, and IOC_LIBCFS_PING to lustre_ioctl_old.h also.
Remove other already obsolete ioctl number definitions.

WC-bug-id: https://jira.whamcloud.com/browse/LU-16634
Lustre-commit: 594b780062db7e015 ("LU-16634 misc: replace obsolete ioctl numbers")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50390
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Vitaliy Kuznetsov <vkuznetsov@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/include/lustre_ioctl_old.h     | 85 ++++++++++++++++++++++++
 fs/lustre/llite/file.c                   | 51 +-------------
 fs/lustre/llite/llite_lib.c              | 11 +--
 fs/lustre/lmv/lmv_obd.c                  |  3 +-
 fs/lustre/lov/lov_obd.c                  |  3 +-
 fs/lustre/mdc/mdc_request.c              |  8 ++-
 fs/lustre/obdclass/class_obd.c           | 16 ++---
 fs/lustre/osc/osc_request.c              |  8 ++-
 include/uapi/linux/lnet/libcfs_ioctl.h   |  7 +-
 include/uapi/linux/lustre/lustre_ioctl.h | 47 +++----------
 include/uapi/linux/lustre/lustre_user.h  | 10 +--
 11 files changed, 128 insertions(+), 121 deletions(-)
 create mode 100644 fs/lustre/include/lustre_ioctl_old.h

diff --git a/fs/lustre/include/lustre_ioctl_old.h b/fs/lustre/include/lustre_ioctl_old.h
new file mode 100644
index 000000000000..0806eafad12b
--- /dev/null
+++ b/fs/lustre/include/lustre_ioctl_old.h
@@ -0,0 +1,85 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * GPL HEADER START
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; If not, see
+ * http://www.gnu.org/licenses/gpl-2.0.html
+ *
+ * GPL HEADER END
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ *
+ * Compatibility for deprecated ioctls that should no longer be used by tools.
+ *
+ * Copyright (c) 2023, DataDirect Networks Storage, all rights reserved.
+ */
+#ifndef __LUSTRE_IOCTL_OLD_H
+#define __LUSTRE_IOCTL_OLD_H
+
+#include <uapi/linux/lnet/libcfs_ioctl.h> /* for IOCTL_LIBCFS_TYPE */
+
+/* ioctl command is deprecated after release v1.v2 */
+#define case_OBD_IOC_DEPRECATED(cmd, dev, v1, v2)			\
+	case cmd:							\
+	if (LUSTRE_VERSION_CODE > OBD_OCD_VERSION(v1, v2, 53, 0)) {	\
+		static bool printed;					\
+		obd_ioctl_msg(__FILE__, __func__, __LINE__,		\
+			      printed ? D_IOCTL : D_WARNING, dev, cmd,	\
+			      "deprecated " #cmd " usage", 0);		\
+		printed = true;						\
+	}
+
+#define case_OBD_IOC_DEPRECATED_FT(cmd, dev, v1, v2)			\
+	case_OBD_IOC_DEPRECATED(cmd, dev, v1, v2)			\
+	fallthrough
+
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 19, 53, 0)
+#define OBD_GET_VERSION		_IOWR('f', 144, OBD_IOC_DATA_TYPE) /*< 2.8.55 */
+#endif
+
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 99, 53, 0)
+/* for binary compatibility until 3.0, no more compiling into tools */
+#define OBD_IOC_GETNAME_OLD	_IOWR('f', 131, OBD_IOC_DATA_TYPE) /*< 2.14.52*/
+
+#define IOC_LIBCFS_GET_NI	_IOWR('e', 50, IOCTL_LIBCFS_TYPE)  /*< 2.15.53*/
+#define IOC_LIBCFS_PING		_IOWR('e', 61, IOCTL_LIBCFS_TYPE)  /*< 2.15.53*/
+
+#if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 19, 53, 0)
+#define OBD_IOC_BARRIER		_IOWR('g', 5, OBD_IOC_DATA_TYPE)   /*< 2.16.55*/
+#define IOC_OSC_SET_ACTIVE	_IOWR('h', 21, void *)		   /*< 2.16.55*/
+#endif
+
+#endif /* OBD_OCD_VERSION(2, 99, 53, 0) */
+
+/* We don't need *_ALLOW() macros for most ioctls, just a few using a bad
+ * _IOC_TYPE value (i.e. not 'f') so that "early exit" type checks work.
+ */
+#define OBD_IOC_CMD_LATE(cmd, name) unlikely(cmd == name)
+#define OBD_IOC_CMD_GONE(cmd, name) (false)
+
+#ifdef OBD_IOC_BARRIER
+#define OBD_IOC_BARRIER_ALLOW(cmd) OBD_IOC_CMD_LATE(cmd, OBD_IOC_BARRIER)
+#else
+#define OBD_IOC_BARRIER_ALLOW(cmd) OBD_IOC_CMD_GONE(cmd)
+#endif
+#ifdef IOC_OSC_SET_ACTIVE
+#define IOC_OSC_SET_ACTIVE_ALLOW(cmd) OBD_IOC_CMD_LATE(cmd, IOC_OSC_SET_ACTIVE)
+#else
+#define IOC_OSC_SET_ACTIVE_ALLOW(cmd) OBD_IOC_CMD_GONE(cmd)
+#endif
+
+#endif /* __LUSTRE_IOCTL_OLD_H */
diff --git a/fs/lustre/llite/file.c b/fs/lustre/llite/file.c
index 84c204e5f9ee..fc9095279a4b 100644
--- a/fs/lustre/llite/file.c
+++ b/fs/lustre/llite/file.c
@@ -4204,39 +4204,10 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 	case LL_IOC_LOV_GETSTRIPE:
 	case LL_IOC_LOV_GETSTRIPE_NEW:
 		return ll_file_getstripe(inode, uarg, 0);
-	case FS_IOC_GETFLAGS:
-	case FS_IOC_SETFLAGS:
-		return ll_iocontrol(inode, file, cmd, uarg);
-	case FSFILT_IOC_GETVERSION:
-	case FS_IOC_GETVERSION:
-		return put_user(inode->i_generation, (int __user *)arg);
-	/* We need to special case any other ioctls we want to handle,
-	 * to send them to the MDS/OST as appropriate and to properly
-	 * network encode the arg field.
-	 */
-	case FS_IOC_SETVERSION:
-		return -ENOTSUPP;
-
 	case LL_IOC_GROUP_LOCK:
 		return ll_get_grouplock(inode, file, arg);
 	case LL_IOC_GROUP_UNLOCK:
 		return ll_put_grouplock(inode, file, arg);
-	case IOC_OBD_STATFS:
-		return ll_obd_statfs(inode, uarg);
-
-	case LL_IOC_FLUSHCTX:
-		return ll_flush_ctx(inode);
-	case LL_IOC_PATH2FID: {
-		if (copy_to_user(uarg, ll_inode2fid(inode),
-				 sizeof(struct lu_fid)))
-			return -EFAULT;
-
-		return 0;
-	}
-	case LL_IOC_GETPARENT:
-		return ll_getparent(file, (struct getparent __user *)arg);
-	case OBD_IOC_FID2PATH:
-		return ll_fid2path(inode, uarg);
 	case LL_IOC_DATA_VERSION: {
 		struct ioc_data_version	idv;
 		int rc;
@@ -4246,31 +4217,11 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 
 		idv.idv_flags &= LL_DV_RD_FLUSH | LL_DV_WR_FLUSH;
 		rc = ll_ioc_data_version(inode, &idv);
-		if (rc == 0 && copy_to_user(uarg, &idv,
-					    sizeof(idv)))
+		if (rc == 0 && copy_to_user(uarg, &idv, sizeof(idv)))
 			return -EFAULT;
 
 		return rc;
 	}
-
-	case LL_IOC_GET_MDTIDX: {
-		int mdtidx;
-
-		mdtidx = ll_get_mdt_idx(inode);
-		if (mdtidx < 0)
-			return mdtidx;
-
-		if (put_user(mdtidx, (int __user *)uarg))
-			return -EFAULT;
-
-		return 0;
-	}
-	case OBD_IOC_GETNAME_OLD:
-		fallthrough;
-	case OBD_IOC_GETDTNAME:
-		fallthrough;
-	case OBD_IOC_GETMDNAME:
-		return ll_get_obd_name(inode, cmd, uarg);
 	case LL_IOC_HSM_STATE_GET: {
 		struct md_op_data *op_data;
 		struct hsm_user_state *hus;
diff --git a/fs/lustre/llite/llite_lib.c b/fs/lustre/llite/llite_lib.c
index 7efa5b0246b8..b158eccc16c8 100644
--- a/fs/lustre/llite/llite_lib.c
+++ b/fs/lustre/llite/llite_lib.c
@@ -52,6 +52,7 @@
 
 #include <linux/libcfs/libcfs_cpu.h>
 #include <uapi/linux/lustre/lustre_ioctl.h>
+#include <lustre_ioctl_old.h>
 #include <lustre_ha.h>
 #include <lustre_dlm.h>
 #include <lprocfs_status.h>
@@ -3059,8 +3060,10 @@ int ll_iocontrol(struct inode *inode, struct file *file,
 	case OBD_IOC_FID2PATH:
 		rc = ll_fid2path(inode, uarg);
 		break;
-	case OBD_IOC_GETNAME_OLD:
-		fallthrough;
+#ifdef OBD_IOC_GETNAME_OLD
+	case_OBD_IOC_DEPRECATED_FT(OBD_IOC_GETNAME_OLD,
+				   sbi->ll_md_exp->exp_obd->obd_name, 2, 16);
+#endif
 	case OBD_IOC_GETDTNAME:
 		fallthrough;
 	case OBD_IOC_GETMDNAME:
@@ -3119,10 +3122,10 @@ void ll_umount_begin(struct super_block *sb)
 
 	ioc_data = kzalloc(sizeof(*ioc_data), GFP_NOFS);
 	if (ioc_data) {
-		obd_iocontrol(IOC_OSC_SET_ACTIVE, sbi->ll_md_exp,
+		obd_iocontrol(OBD_IOC_SET_ACTIVE, sbi->ll_md_exp,
 			      sizeof(*ioc_data), ioc_data, NULL);
 
-		obd_iocontrol(IOC_OSC_SET_ACTIVE, sbi->ll_dt_exp,
+		obd_iocontrol(OBD_IOC_SET_ACTIVE, sbi->ll_dt_exp,
 			      sizeof(*ioc_data), ioc_data, NULL);
 
 		kfree(ioc_data);
diff --git a/fs/lustre/lmv/lmv_obd.c b/fs/lustre/lmv/lmv_obd.c
index 27c1df26849c..f7c7826d0baf 100644
--- a/fs/lustre/lmv/lmv_obd.c
+++ b/fs/lustre/lmv/lmv_obd.c
@@ -51,6 +51,7 @@
 #include <cl_object.h>
 #include <lustre_fid.h>
 #include <uapi/linux/lustre/lustre_ioctl.h>
+#include <lustre_ioctl_old.h>
 #include <lustre_kernelcomm.h>
 #include "lmv_internal.h"
 
@@ -838,7 +839,7 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp,
 		return -ENOTTY;
 
 	/* exit early for unknown ioctl types */
-	if (unlikely(_IOC_TYPE(cmd) != 'f' && cmd != IOC_OSC_SET_ACTIVE))
+	if (unlikely(_IOC_TYPE(cmd) != 'f' && !IOC_OSC_SET_ACTIVE_ALLOW(cmd)))
 		return OBD_IOC_ERROR(obd->obd_name, cmd, "unknown", -ENOTTY);
 
 	/* handle commands that don't use @karg first */
diff --git a/fs/lustre/lov/lov_obd.c b/fs/lustre/lov/lov_obd.c
index a152f0b2d2ec..392395f4c35e 100644
--- a/fs/lustre/lov/lov_obd.c
+++ b/fs/lustre/lov/lov_obd.c
@@ -47,6 +47,7 @@
 #include <cl_object.h>
 #include <lustre_dlm.h>
 #include <lustre_fid.h>
+#include <lustre_ioctl_old.h>
 #include <lustre_lib.h>
 #include <lustre_net.h>
 #include <uapi/linux/lustre/lustre_param.h>
@@ -974,7 +975,7 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 	       exp->exp_obd->obd_name, cmd, len, karg, uarg);
 
 	/* exit early for unknown ioctl types */
-	if (unlikely(_IOC_TYPE(cmd) != 'f' && cmd != IOC_OSC_SET_ACTIVE))
+	if (unlikely(_IOC_TYPE(cmd) != 'f' && !IOC_OSC_SET_ACTIVE_ALLOW(cmd)))
 		return OBD_IOC_DEBUG(D_IOCTL, obd->obd_name, cmd, "unknown",
 				     -ENOTTY);
 
diff --git a/fs/lustre/mdc/mdc_request.c b/fs/lustre/mdc/mdc_request.c
index 55a7b5cf1249..5919e5952c0e 100644
--- a/fs/lustre/mdc/mdc_request.c
+++ b/fs/lustre/mdc/mdc_request.c
@@ -49,12 +49,13 @@
 #include <lustre_acl.h>
 #include <lustre_fid.h>
 #include <uapi/linux/lustre/lustre_ioctl.h>
+#include <lustre_ioctl_old.h>
 #include <lustre_kernelcomm.h>
 #include <lustre_lmv.h>
 #include <lustre_log.h>
+#include <lustre_osc.h>
 #include <lustre_swab.h>
 #include <obd_class.h>
-#include <lustre_osc.h>
 
 #include "mdc_internal.h"
 
@@ -2260,7 +2261,10 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 			goto out;
 		rc = 0;
 		goto out;
-	case IOC_OSC_SET_ACTIVE:
+#ifdef IOC_OSC_SET_ACTIVE
+	case_OBD_IOC_DEPRECATED_FT(IOC_OSC_SET_ACTIVE, obd->obd_name, 2, 17);
+#endif
+	case OBD_IOC_SET_ACTIVE:
 		rc = ptlrpc_set_import_active(imp, data->ioc_offset);
 		goto out;
 
diff --git a/fs/lustre/obdclass/class_obd.c b/fs/lustre/obdclass/class_obd.c
index dabd40da5912..ab27cf23ca9a 100644
--- a/fs/lustre/obdclass/class_obd.c
+++ b/fs/lustre/obdclass/class_obd.c
@@ -47,6 +47,7 @@
 #include <uapi/linux/lustre/lustre_ioctl.h>
 #include <uapi/linux/lnet/libcfs_ioctl.h>
 #include "llog_internal.h"
+#include <lustre_ioctl_old.h>
 
 /* The following are visible and mutable through /sys/fs/lustre. */
 unsigned int obd_debug_peer_on_timeout;
@@ -341,14 +342,8 @@ int class_handle_ioctl(unsigned int cmd, void __user *uarg)
 		goto out;
 	}
 
-	case OBD_GET_VERSION: {
-		/* This was the method to pass to user land the lustre version.
-		 * Today that information is in the sysfs tree so we can in the
-		 * future remove this.
-		 */
-		BUILD_BUG_ON(OBD_OCD_VERSION(3, 0, 53, 0) <=
-			     LUSTRE_VERSION_CODE);
-
+#ifdef OBD_GET_VERSION
+	case_OBD_IOC_DEPRECATED(OBD_GET_VERSION, "obdclass", 2, 15)
 		if (!data->ioc_inlbuf1) {
 			rc = OBD_IOC_ERROR("obdclass", cmd, "no buffer passed",
 					   -EINVAL);
@@ -361,16 +356,13 @@ int class_handle_ioctl(unsigned int cmd, void __user *uarg)
 			goto out;
 		}
 
-		WARN_ONCE(1,
-			  "ioctl(OBD_GET_VERSION) is deprecated, use llapi_get_version_string() and/or relink\n");
-
 		memcpy(data->ioc_bulk, LUSTRE_VERSION_STRING,
 		       strlen(LUSTRE_VERSION_STRING) + 1);
 
 		if (copy_to_user(uarg, data, len))
 			rc = -EFAULT;
 		goto out;
-	}
+#endif
 	case OBD_IOC_NAME2DEV: {
 		/* Resolve a device name.  This does not change the
 		 * currently selected device.
diff --git a/fs/lustre/osc/osc_request.c b/fs/lustre/osc/osc_request.c
index 582cd96c304b..128b7d15d760 100644
--- a/fs/lustre/osc/osc_request.c
+++ b/fs/lustre/osc/osc_request.c
@@ -46,11 +46,12 @@
 #include <lustre_ha.h>
 #include <lprocfs_status.h>
 #include <uapi/linux/lustre/lustre_ioctl.h>
+#include <lustre_ioctl_old.h>
 #include <lustre_obdo.h>
+#include <lustre_osc.h>
 #include <lustre_fid.h>
 #include <obd_class.h>
 #include <obd.h>
-#include <lustre_osc.h>
 
 #include "osc_internal.h"
 
@@ -3397,7 +3398,10 @@ static int osc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 		data = karg;
 		rc = obd_getattr(NULL, exp, &data->ioc_obdo1);
 		break;
-	case IOC_OSC_SET_ACTIVE:
+#ifdef IOC_OSC_SET_ACTIVE
+	case_OBD_IOC_DEPRECATED_FT(IOC_OSC_SET_ACTIVE, obd->obd_name, 2, 17);
+#endif
+	case OBD_IOC_SET_ACTIVE:
 		if (unlikely(!karg)) {
 			OBD_IOC_ERROR(obd->obd_name, cmd, "karg=NULL",
 				      rc = -EINVAL);
diff --git a/include/uapi/linux/lnet/libcfs_ioctl.h b/include/uapi/linux/lnet/libcfs_ioctl.h
index a77a736c1107..98b61b1f1292 100644
--- a/include/uapi/linux/lnet/libcfs_ioctl.h
+++ b/include/uapi/linux/lnet/libcfs_ioctl.h
@@ -89,20 +89,19 @@ struct libcfs_ioctl_data {
 #define IOC_LIBCFS_TYPE			('e')
 #define IOC_LIBCFS_MIN_NR		30
 /* libcfs ioctls */
-/* IOC_LIBCFS_PANIC obsolete in 2.8.0, was _IOWR('e', 30, IOCTL_LIBCFS_TYPE) */
+/* XXX: all of these ioctl definitions are broken, the first parameter
+ * should be IOCTL_LIBCFS_TYPE and the last parameter is the struct size.
+ */
 #define IOC_LIBCFS_CLEAR_DEBUG		_IOWR('e', 31, IOCTL_LIBCFS_TYPE)
 #define IOC_LIBCFS_MARK_DEBUG		_IOWR('e', 32, IOCTL_LIBCFS_TYPE)
-/* IOC_LIBCFS_MEMHOG obsolete in 2.8.0, was _IOWR('e', 36, IOCTL_LIBCFS_TYPE) */
 /* lnet ioctls */
 #define IOC_LIBCFS_GET_NI		_IOWR('e', 50, IOCTL_LIBCFS_TYPE)
 #define IOC_LIBCFS_FAIL_NID		_IOWR('e', 51, IOCTL_LIBCFS_TYPE)
 #define IOC_LIBCFS_NOTIFY_ROUTER	_IOWR('e', 55, IOCTL_LIBCFS_TYPE)
 #define IOC_LIBCFS_UNCONFIGURE		_IOWR('e', 56, IOCTL_LIBCFS_TYPE)
-/*	 IOC_LIBCFS_PORTALS_COMPATIBILITY  _IOWR('e', 57, IOCTL_LIBCFS_TYPE) */
 #define IOC_LIBCFS_LNET_DIST		_IOWR('e', 58, IOCTL_LIBCFS_TYPE)
 #define IOC_LIBCFS_CONFIGURE		_IOWR('e', 59, IOCTL_LIBCFS_TYPE)
 #define IOC_LIBCFS_TESTPROTOCOMPAT	_IOWR('e', 60, IOCTL_LIBCFS_TYPE)
-/* IOC_LIBCFS_PING obsolete in 2.16, was _IOWR('e', 61, IOCTL_LIBCFS_TYPE) */
 #define IOC_LIBCFS_PING_PEER		_IOWR('e', 62, IOCTL_LIBCFS_TYPE)
 #define IOC_LIBCFS_LNETST		_IOWR('e', 63, IOCTL_LIBCFS_TYPE)
 #define IOC_LIBCFS_LNET_FAULT		_IOWR('e', 64, IOCTL_LIBCFS_TYPE)
diff --git a/include/uapi/linux/lustre/lustre_ioctl.h b/include/uapi/linux/lustre/lustre_ioctl.h
index fb1e6f1c5e8c..fa1f802e9391 100644
--- a/include/uapi/linux/lustre/lustre_ioctl.h
+++ b/include/uapi/linux/lustre/lustre_ioctl.h
@@ -32,6 +32,7 @@
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/lustre/lustre_idl.h>
+#include <linux/lustre/lustre_ver.h>
 
 /*
  * sparse kernel source annotations
@@ -134,7 +135,14 @@ static inline __u32 obd_ioctl_packlen(struct obd_ioctl_data *data)
 
 #define OBD_IOC_CREATE		_IOWR('f', 101, OBD_IOC_DATA_TYPE)
 #define OBD_IOC_DESTROY		_IOW('f', 104, OBD_IOC_DATA_TYPE)
-/*	OBD_IOC_PREALLOCATE	_IOWR('f', 105, OBD_IOC_DATA_TYPE) */
+#define OBD_IOC_BARRIER_V2	_IOW('f', 105, struct obd_ioctl_data)
+#define OBD_IOC_SET_ACTIVE	_IOW('f', 106, struct obd_ioctl_data)
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 19, 53, 0)
+/* for API compatibility until 2.19.x, but prefer to use new IOC values above */
+/* OBD_IOC_BARRIER wrongly defined as _IOWR('f', 261, OBD_IOC_DATA_TYPE) */
+#define OBD_IOC_BARRIER		_IOWR('g', 5, OBD_IOC_DATA_TYPE) /* < 2.16 */
+#define IOC_OSC_SET_ACTIVE	_IOWR('h', 21, void *) /* deprecated 2.16 */
+#endif
 
 #define OBD_IOC_SETATTR		_IOW('f', 107, OBD_IOC_DATA_TYPE)
 #define OBD_IOC_GETATTR		_IOWR('f', 108, OBD_IOC_DATA_TYPE)
@@ -150,42 +158,21 @@ static inline __u32 obd_ioctl_packlen(struct obd_ioctl_data *data)
 #define OBD_IOC_GETDTNAME	_IOR('f', 127, char[MAX_OBD_NAME])
 /* ioctl codes 128-143 are reserved for fsverity */
 #define OBD_IOC_UUID2DEV	_IOWR('f', 130, OBD_IOC_DATA_TYPE)
-#define OBD_IOC_GETNAME_OLD	_IOWR('f', 131, OBD_IOC_DATA_TYPE)
 #define OBD_IOC_GETMDNAME	_IOR('f', 131, char[MAX_OBD_NAME])
-/*	OBD_IOC_LOV_GET_CONFIG	_IOWR('f', 132, OBD_IOC_DATA_TYPE) until 2.14 */
 #define OBD_IOC_CLIENT_RECOVER	_IOW('f', 133, OBD_IOC_DATA_TYPE)
 /* ioctl codes 128-143 are reserved for fsverity */
-/* FS_IOC_ENABLE_VERITY		_IOW('f', 133, struct fsverity_enable_arg) */
-/* FS_IOC_MEASURE_VERITY	_IOW('f', 134, struct fsverity_digest) */
-/* was OBD_IOC_NO_TRANSNO	_IOW('f', 140, OBD_IOC_DATA_TYPE) until 2.14 */
 #define OBD_IOC_SET_READONLY	_IOW('f', 141, OBD_IOC_DATA_TYPE)
 #define OBD_IOC_ABORT_RECOVERY	_IOR('f', 142, OBD_IOC_DATA_TYPE)
 /* ioctl codes 128-143 are reserved for fsverity */
-#define OBD_GET_VERSION		_IOWR('f', 144, OBD_IOC_DATA_TYPE)
-/*	OBD_IOC_GSS_SUPPORT	_IOWR('f', 145, OBD_IOC_DATA_TYPE) */
-/*	OBD_IOC_CLOSE_UUID	_IOWR('f', 147, OBD_IOC_DATA_TYPE) */
-/*	OBD_IOC_CHANGELOG_SEND	_IOW('f', 148, OBD_IOC_DATA_TYPE) */
 #define OBD_IOC_GETDEVICE	_IOWR('f', 149, OBD_IOC_DATA_TYPE)
 #define OBD_IOC_FID2PATH	_IOWR('f', 150, OBD_IOC_DATA_TYPE)
-/*	lustre/lustre_user.h	151-153 */
-/*	OBD_IOC_LOV_SETSTRIPE	154 LL_IOC_LOV_SETSTRIPE */
-/*	OBD_IOC_LOV_GETSTRIPE	155 LL_IOC_LOV_GETSTRIPE */
-/*	OBD_IOC_LOV_SETEA	156 LL_IOC_LOV_SETEA */
-/*	lustre/lustre_user.h	157-159 */
-/*	OBD_IOC_QUOTACHECK	_IOW('f', 160, int) */
-/*	OBD_IOC_POLL_QUOTACHECK	_IOR('f', 161, struct if_quotacheck *) */
+/*	lustre/lustre_user.h	151-159 */
 #define OBD_IOC_QUOTACTL	_IOWR('f', 162, struct if_quotactl)
 /*	lustre/lustre_user.h	163-176 */
 #define OBD_IOC_CHANGELOG_REG	_IOW('f', 177, struct obd_ioctl_data)
 #define OBD_IOC_CHANGELOG_DEREG	_IOW('f', 178, struct obd_ioctl_data)
 #define OBD_IOC_CHANGELOG_CLEAR	_IOW('f', 179, struct obd_ioctl_data)
-/*	OBD_IOC_RECORD		_IOWR('f', 180, OBD_IOC_DATA_TYPE) */
-/*	OBD_IOC_ENDRECORD	_IOWR('f', 181, OBD_IOC_DATA_TYPE) */
-/*	OBD_IOC_PARSE		_IOWR('f', 182, OBD_IOC_DATA_TYPE) */
-/*	OBD_IOC_DORECORD	_IOWR('f', 183, OBD_IOC_DATA_TYPE) */
 #define OBD_IOC_PROCESS_CFG	_IOWR('f', 184, OBD_IOC_DATA_TYPE)
-/*	OBD_IOC_DUMP_LOG	_IOWR('f', 185, OBD_IOC_DATA_TYPE) */
-/*	OBD_IOC_CLEAR_LOG	_IOWR('f', 186, OBD_IOC_DATA_TYPE) */
 #define OBD_IOC_PARAM		_IOW('f', 187, OBD_IOC_DATA_TYPE)
 #define OBD_IOC_POOL		_IOWR('f', 188, OBD_IOC_DATA_TYPE)
 #define OBD_IOC_REPLACE_NIDS	_IOWR('f', 189, OBD_IOC_DATA_TYPE)
@@ -196,27 +183,15 @@ static inline __u32 obd_ioctl_packlen(struct obd_ioctl_data *data)
 #define OBD_IOC_LLOG_CANCEL	_IOWR('f', 193, OBD_IOC_DATA_TYPE)
 #define OBD_IOC_LLOG_REMOVE	_IOWR('f', 194, OBD_IOC_DATA_TYPE)
 #define OBD_IOC_LLOG_CHECK	_IOWR('f', 195, OBD_IOC_DATA_TYPE)
-/*	OBD_IOC_LLOG_CATINFO	_IOWR('f', 196, OBD_IOC_DATA_TYPE) */
 #define OBD_IOC_NODEMAP		_IOWR('f', 197, OBD_IOC_DATA_TYPE)
-
-/*	ECHO_IOC_GET_STRIPE	_IOWR('f', 200, OBD_IOC_DATA_TYPE) */
-/*	ECHO_IOC_SET_STRIPE	_IOWR('f', 201, OBD_IOC_DATA_TYPE) */
-/*	ECHO_IOC_ENQUEUE	_IOWR('f', 202, OBD_IOC_DATA_TYPE) */
-/*	ECHO_IOC_CANCEL		_IOWR('f', 203, OBD_IOC_DATA_TYPE) */
-
 #define OBD_IOC_GET_OBJ_VERSION	_IOR('f', 210, OBD_IOC_DATA_TYPE)
-
 /*	lustre/lustre_user.h	212-217 */
-#define OBD_IOC_GET_MNTOPT	_IOW('f', 220, mntopt_t)
 #define OBD_IOC_ECHO_MD		_IOR('f', 221, struct obd_ioctl_data)
 #define OBD_IOC_ECHO_ALLOC_SEQ	_IOWR('f', 222, struct obd_ioctl_data)
 #define OBD_IOC_START_LFSCK	_IOWR('f', 230, OBD_IOC_DATA_TYPE)
 #define OBD_IOC_STOP_LFSCK	_IOW('f', 231, OBD_IOC_DATA_TYPE)
 #define OBD_IOC_QUERY_LFSCK	_IOR('f', 232, struct obd_ioctl_data)
 #define OBD_IOC_CHLG_POLL	_IOR('f', 233, long)
-/*	lustre/lustre_user.h	240-249 */
-/* was LIBCFS_IOC_DEBUG_MASK   _IOWR('f', 250, long) until 2.11 */
-
-#define IOC_OSC_SET_ACTIVE	_IOWR('h', 21, void *)
+/*	lustre/lustre_user.h	240-253 */
 
 #endif /* _UAPI_LUSTRE_IOCTL_H_ */
diff --git a/include/uapi/linux/lustre/lustre_user.h b/include/uapi/linux/lustre/lustre_user.h
index 8f648ecd91fa..c098d119f18c 100644
--- a/include/uapi/linux/lustre/lustre_user.h
+++ b/include/uapi/linux/lustre/lustre_user.h
@@ -316,17 +316,10 @@ struct ll_ioc_lease_id {
 #define LL_IOC_LOV_GETSTRIPE		_IOW('f', 155, long)
 #define LL_IOC_LOV_GETSTRIPE_NEW	_IOR('f', 155, struct lov_user_md)
 #define LL_IOC_LOV_SETEA		_IOW('f', 156, long)
-/*	LL_IOC_RECREATE_OBJ		157 obsolete */
-/*	LL_IOC_RECREATE_FID		158 obsolete */
 #define LL_IOC_GROUP_LOCK		_IOW('f', 158, long)
 #define LL_IOC_GROUP_UNLOCK		_IOW('f', 159, long)
-/* #define LL_IOC_QUOTACHECK		160 OBD_IOC_QUOTACHECK */
-/* #define LL_IOC_POLL_QUOTACHECK	161 OBD_IOC_POLL_QUOTACHECK */
-/* #define LL_IOC_QUOTACTL		162 OBD_IOC_QUOTACTL */
 #define IOC_OBD_STATFS			_IOWR('f', 164, struct obd_statfs *)
-/*	IOC_LOV_GETINFO			165 obsolete */
 #define LL_IOC_FLUSHCTX			_IOW('f', 166, long)
-/* LL_IOC_RMTACL			167 obsolete */
 #define LL_IOC_GETOBDCOUNT		_IOR('f', 168, long)
 #define LL_IOC_LLOOP_ATTACH		_IOWR('f', 169, long)
 #define LL_IOC_LLOOP_DETACH		_IOWR('f', 170, long)
@@ -350,8 +343,7 @@ struct ll_ioc_lease_id {
 						struct lustre_swap_layouts)
 #define LL_IOC_HSM_ACTION		_IOR('f', 220, \
 						struct hsm_current_action)
-/* see <lustre_lib.h> for ioctl numbers 221-232 */
-
+/* see <lustre_lib.h> for ioctl numbers 221-233 */
 #define LL_IOC_LMV_SETSTRIPE		_IOWR('f', 240, struct lmv_user_md)
 #define LL_IOC_LMV_GETSTRIPE		_IOWR('f', 241, struct lmv_user_md)
 #define LL_IOC_RMFID			_IOR('f', 242, struct fid_array)
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 19/33] lustre: lmv: treat unknown hash type as sane type
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (17 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 18/33] lustre: misc: replace obsolete ioctl numbers James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 20/33] lustre: llite: Fix return for non-queued aio James Simmons
                   ` (13 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Lai Siyao, Hongchao Zhang, Lustre Development List

From: Lai Siyao <lai.siyao@whamcloud.com>

Directory migration failure may leave directory hash type as
LMV_HASH_TYPE_UNKNOWN|LMV_HASH_FLAG_BAD_TYPE, which should be treated
as sane hash type on existing directories, otherwise such directories
can't be unlinked.

WC-bug-id: https://jira.whamcloud.com/browse/LU-16717
Lustre-commit: 05cdb71ba68135701 ("LU-16717 mdt: treat unknown hash type as sane type")
Signed-off-by: Lai Siyao <lai.siyao@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50796
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Hongchao Zhang <hongchao@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/include/lustre_lmv.h          |  4 ++--
 include/uapi/linux/lustre/lustre_user.h | 10 ++++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/fs/lustre/include/lustre_lmv.h b/fs/lustre/include/lustre_lmv.h
index a2ef550e38d4..5e3dbc52e846 100644
--- a/fs/lustre/include/lustre_lmv.h
+++ b/fs/lustre/include/lustre_lmv.h
@@ -443,7 +443,7 @@ static inline bool lmv_is_sane(const struct lmv_mds_md_v1 *lmv)
 	if (le32_to_cpu(lmv->lmv_stripe_count) == 0)
 		goto insane;
 
-	if (!lmv_is_known_hash_type(le32_to_cpu(lmv->lmv_hash_type)))
+	if (!lmv_is_sane_hash_type(le32_to_cpu(lmv->lmv_hash_type)))
 		goto insane;
 
 	return true;
@@ -465,7 +465,7 @@ static inline bool lmv_is_sane2(const struct lmv_mds_md_v1 *lmv)
 	if (le32_to_cpu(lmv->lmv_stripe_count) == 0)
 		goto insane;
 
-	if (!lmv_is_known_hash_type(le32_to_cpu(lmv->lmv_hash_type)))
+	if (!lmv_is_sane_hash_type(le32_to_cpu(lmv->lmv_hash_type)))
 		goto insane;
 
 	return true;
diff --git a/include/uapi/linux/lustre/lustre_user.h b/include/uapi/linux/lustre/lustre_user.h
index c098d119f18c..4b49bb9c370a 100644
--- a/include/uapi/linux/lustre/lustre_user.h
+++ b/include/uapi/linux/lustre/lustre_user.h
@@ -794,6 +794,16 @@ static inline bool lmv_is_known_hash_type(__u32 type)
 
 #define LMV_HASH_FLAG_KNOWN		0xbe000000
 
+/* migration failure may leave hash type as
+ * LMV_HASH_TYPE_UNKNOWN|LMV_HASH_FLAG_BAD_TYPE, which should be treated as
+ * sane, so such directory can be accessed (resume migration or unlink).
+ */
+static inline bool lmv_is_sane_hash_type(__u32 type)
+{
+	return lmv_is_known_hash_type(type) ||
+	       type == (LMV_HASH_TYPE_UNKNOWN | LMV_HASH_FLAG_BAD_TYPE);
+}
+
 /* both SPLIT and MIGRATION are set for directory split */
 static inline bool lmv_hash_is_splitting(__u32 hash)
 {
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 20/33] lustre: llite: Fix return for non-queued aio
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (18 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 19/33] lustre: lmv: treat unknown hash type as sane type James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 21/33] lnet: collect data about routes by using Netlink James Simmons
                   ` (12 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown; +Cc: Zhenyu Xu, Lustre Development List

From: Patrick Farrell <pfarrell@whamcloud.com>

If an AIO fails or is completed synchronously (even
partially), the VFS will handle calling the completion
callback to finish the AIO, and so Lustre needs to return
the number of bytes successfully completed to the VFS.

This fixes a bug where if an AIO was racing with buffered
I/O, the AIO would fall back to buffered I/O, causing it to
complete before returning to the VFS rather than being
queued.  In this case, Lustre would return 0 the VFS, and
the VFS would complete the AIO and report 0 bytes moved.

This fixes the logic for this.

WC-bug-id: https://jira.whamcloud.com/browse/LU-13805
Lustre-commit: 8a5bb81f774b9d41f ("LU-13805 llite: Fix return for non-queued aio")
Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49915
Reviewed-by: Zhenyu Xu <bobijam@hotmail.com>
Reviewed-by: Qian Yingjin <qian@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/llite/file.c | 51 +++++++++++++++++++++++-------------------
 fs/lustre/llite/rw26.c |  1 -
 2 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/fs/lustre/llite/file.c b/fs/lustre/llite/file.c
index fc9095279a4b..e745dc8c53a5 100644
--- a/fs/lustre/llite/file.c
+++ b/fs/lustre/llite/file.c
@@ -1832,21 +1832,12 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args,
 		range_locked = false;
 	}
 
-	/*
-	 * In order to move forward AIO, ci_nob was increased,
-	 * but that doesn't mean io have been finished, it just
-	 * means io have been submited, we will always return
-	 * EIOCBQUEUED to the caller, So we could only return
-	 * number of bytes in non-AIO case.
-	 */
 	if (io->ci_nob > 0) {
-		if (!is_aio) {
-			if (rc2 == 0) {
-				result += io->ci_nob;
-				*ppos = io->u.ci_wr.wr.crw_pos; /* for splice */
-			} else if (rc2) {
-				result = 0;
-			}
+		if (rc2 == 0) {
+			result += io->ci_nob;
+			*ppos = io->u.ci_wr.wr.crw_pos; /* for splice */
+		} else if (rc2) {
+			result = 0;
 		}
 		count -= io->ci_nob;
 
@@ -1886,22 +1877,36 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args,
 	}
 
 	if (io->ci_dio_aio) {
+		/* set the number of bytes successfully moved in the aio */
+		if (result > 0)
+			io->ci_dio_aio->cda_bytes = result;
 		/*
 		 * VFS will call aio_complete() if no -EIOCBQUEUED
 		 * is returned for AIO, so we can not call aio_complete()
-		 * in our end_io().
+		 * in our end_io().  (cda_no_aio_complete is always set for
+		 * normal DIO.)
 		 *
-		 * NB: This is safe because the atomic_dec_and_lock  in
-		 * cl_sync_io_init has implicit memory barriers, so this will
-		 * be seen by whichever thread completes the DIO/AIO, even if
-		 * it's not this one
+		 * NB: Setting cda_no_aio_complete like this is safe because
+		 * the atomic_dec_and_lock in cl_sync_io_note has implicit
+		 * memory barriers, so this will be seen by whichever thread
+		 * completes the DIO/AIO, even if it's not this one.
 		 */
-		if (rc != -EIOCBQUEUED)
+		if (is_aio && rc != -EIOCBQUEUED)
 			io->ci_dio_aio->cda_no_aio_complete = 1;
+		/* if an aio enqueued successfully (-EIOCBQUEUED), then Lustre
+		 * will call aio_complete rather than the vfs, so we return 0
+		 * to tell the VFS we're handling it
+		 */
+		else if (is_aio) /* rc == -EIOCBQUEUED */
+			result = 0;
 		/**
-		 * Drop one extra reference so that end_io() could be
-		 * called for this IO context, we could call it after
-		 * we make sure all AIO requests have been proceed.
+		 * Drop the reference held by the llite layer on this top level
+		 * IO context.
+		 *
+		 * For DIO, this frees it here, since IO is complete, and for
+		 * AIO, we will call aio_complete() (and then free this top
+		 * level context) once all the outstanding chunks of this AIO
+		 * have completed.
 		 */
 		cl_sync_io_note(env, &io->ci_dio_aio->cda_sync,
 				rc == -EIOCBQUEUED ? 0 : rc);
diff --git a/fs/lustre/llite/rw26.c b/fs/lustre/llite/rw26.c
index ad7308a8c902..9239e029276e 100644
--- a/fs/lustre/llite/rw26.c
+++ b/fs/lustre/llite/rw26.c
@@ -425,7 +425,6 @@ static ssize_t ll_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
 	}
 
 out:
-	ll_dio_aio->cda_bytes += tot_bytes;
 
 	if (rw == WRITE)
 		vio->u.readwrite.vui_written += tot_bytes;
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 21/33] lnet: collect data about routes by using Netlink
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (19 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 20/33] lustre: llite: Fix return for non-queued aio James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 22/33] lustre: ptlrpc: switch sptlrpc_rule_set_choose to large nid James Simmons
                   ` (11 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Chris Horn, Cyril Bordage, Serguei Smirnov,
	Lustre Development List

Migrate the LNet route API to use the Netlink API for
the case of collecting data about routes. This change also
allows large NID support for IPv6. Support for adding and
deleting routes with Netlink will be done in an follow on
patch.

WC-bug-id: https://jira.whamcloud.com/browse/LU-9680
Lustre-commit: 4ccac8297d0a60027 ("LU-9680 lnet: collect data about routes by using Netlink")
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49839
WC-bug-id: https://jira.whamcloud.com/brose/LU-10391
Lustre-commit: 7d9643b5b9373b1f8 ("LU-10391 lnet: use GFP_ATOMIC for alloc under spinlock")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53597
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Cyril Bordage <cbordage@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
---
 include/linux/lnet/lib-types.h     |  40 +++
 include/uapi/linux/lnet/lnet-dlc.h |   7 +-
 net/lnet/lnet/api-ni.c             | 396 +++++++++++++++++++++++++++++
 3 files changed, 440 insertions(+), 3 deletions(-)

diff --git a/include/linux/lnet/lib-types.h b/include/linux/lnet/lib-types.h
index bc9f0020f93a..0de7654e3a67 100644
--- a/include/linux/lnet/lib-types.h
+++ b/include/linux/lnet/lib-types.h
@@ -557,6 +557,46 @@ enum lnet_net_local_ni_tunables_attr {
 
 #define LNET_NET_LOCAL_NI_TUNABLES_ATTR_MAX (__LNET_NET_LOCAL_NI_TUNABLES_ATTR_MAX_PLUS_ONE - 1)
 
+/** enum lnet_route_attrs		      - LNet route netlink
+ *						attributes that describe
+ *						LNet routes
+ *
+ * @LNET_ROUTE_ATTR_UNSPEC:			unspecified attribute to
+ *						catch errors
+ *
+ * @LNET_ROUTE_ATTR_HDR:			grouping for LNet route data
+ *						(NLA_NUL_STRING)
+ * @LNET_ROUTE_ATTR_NET:			LNet remote network reached
+ *						by the route (NLA_STRING)
+ * @LNET_ROUTE_ATTR_GATEWAY:			gateway for the route
+ *						(NLA_STRING)
+ * @LNET_ROUTE_ATTR_HOP:			route hop count (NLA_S32)
+ *
+ * @LNET_ROUTE_ATTR_PRIORITY:			rank of this network path
+ *						(NLA_U32)
+ * @LNET_ROUTE_ATTR_HEALTH_SENSITIVITY:		rate of health value change
+ *						for the route (NLA_U32)
+ * @LNET_ROUTE_ATTR_STATE:			state of route (NLA_STRING)
+ *
+ * @LNET_ROUTE_ATTR_TYPE:			Report if we support multi-hop
+ *						(NLA_STRING)
+ */
+enum lnet_route_attrs {
+	LNET_ROUTE_ATTR_UNSPEC = 0,
+
+	LNET_ROUTE_ATTR_HDR,
+	LNET_ROUTE_ATTR_NET,
+	LNET_ROUTE_ATTR_GATEWAY,
+	LNET_ROUTE_ATTR_HOP,
+	LNET_ROUTE_ATTR_PRIORITY,
+	LNET_ROUTE_ATTR_HEALTH_SENSITIVITY,
+	LNET_ROUTE_ATTR_STATE,
+	LNET_ROUTE_ATTR_TYPE,
+	__LNET_ROUTE_ATTR_MAX_PLUS_ONE,
+};
+
+#define LNET_ROUTE_ATTR_MAX (__LNET_ROUTE_ATTR_MAX_PLUS_ONE - 1)
+
 /** LNet netlink ping API */
 
 /** enum lnet_ping_atts				      - LNet ping netlink properties
diff --git a/include/uapi/linux/lnet/lnet-dlc.h b/include/uapi/linux/lnet/lnet-dlc.h
index fc1d40ce8756..d7592f3fd1f8 100644
--- a/include/uapi/linux/lnet/lnet-dlc.h
+++ b/include/uapi/linux/lnet/lnet-dlc.h
@@ -54,10 +54,11 @@
 
 /* enum lnet_commands	      - Supported core LNet Netlink commands
  *
- *  @LNET_CMD_UNSPEC:		unspecified command to catch errors
+ * @LNET_CMD_UNSPEC:		unspecified command to catch errors
  *
- *  @LNET_CMD_NETS:		command to manage the LNet networks
- *  @LNET_CMD_PING:		command to send pings to LNet connections
+ * @LNET_CMD_NETS:		command to manage the LNet networks
+ * @LNET_CMD_ROUTES:		command to manage LNet routes
+ * @LNET_CMD_PING:		command to send pings to LNet connections
  */
 enum lnet_commands {
 	LNET_CMD_UNSPEC		= 0,
diff --git a/net/lnet/lnet/api-ni.c b/net/lnet/lnet/api-ni.c
index fa42cfd99aa7..d3d51acdf2ad 100644
--- a/net/lnet/lnet/api-ni.c
+++ b/net/lnet/lnet/api-ni.c
@@ -5322,6 +5322,395 @@ static int lnet_net_cmd(struct sk_buff *skb, struct genl_info *info)
 	return rc;
 }
 
+/** LNet route handling */
+
+/* We can't use struct lnet_ioctl_config_data since it lacks
+ * support for large NIDS
+ */
+struct lnet_route_properties {
+	struct lnet_nid		lrp_gateway;
+	u32			lrp_net;
+	s32			lrp_hop;
+	u32			lrp_flags;
+	u32			lrp_priority;
+	u32			lrp_sensitivity;
+};
+
+struct lnet_genl_route_list {
+	unsigned int				lgrl_index;
+	unsigned int				lgrl_count;
+	GENRADIX(struct lnet_route_properties)	lgrl_list;
+};
+
+static inline struct lnet_genl_route_list *
+lnet_route_dump_ctx(struct netlink_callback *cb)
+{
+	return (struct lnet_genl_route_list *)cb->args[0];
+}
+
+static int lnet_route_show_done(struct netlink_callback *cb)
+{
+	struct lnet_genl_route_list *rlist = lnet_route_dump_ctx(cb);
+
+	if (rlist) {
+		genradix_free(&rlist->lgrl_list);
+		kfree(rlist);
+	}
+	cb->args[0] = 0;
+
+	return 0;
+}
+
+int lnet_scan_route(struct lnet_genl_route_list *rlist,
+		    struct lnet_route_properties *settings)
+{
+	struct lnet_remotenet *rnet;
+	struct list_head *rn_list;
+	struct lnet_route *route;
+	int cpt, i, rc = 0;
+
+	cpt = lnet_net_lock_current();
+
+	for (i = 0; i < LNET_REMOTE_NETS_HASH_SIZE; i++) {
+		rn_list = &the_lnet.ln_remote_nets_hash[i];
+		list_for_each_entry(rnet, rn_list, lrn_list) {
+			if (settings->lrp_net != LNET_NET_ANY &&
+			    settings->lrp_net != rnet->lrn_net)
+				continue;
+
+			list_for_each_entry(route, &rnet->lrn_routes,
+					    lr_list) {
+				struct lnet_route_properties *prop;
+
+				if (!LNET_NID_IS_ANY(&settings->lrp_gateway) &&
+				    !nid_same(&settings->lrp_gateway,
+					      &route->lr_nid)) {
+					continue;
+				}
+
+				if (settings->lrp_hop != -1 &&
+				    settings->lrp_hop != route->lr_hops)
+					continue;
+
+				if (settings->lrp_priority != -1 &&
+				    settings->lrp_priority != route->lr_priority)
+					continue;
+
+				if (settings->lrp_sensitivity != -1 &&
+				    settings->lrp_sensitivity !=
+				    route->lr_gateway->lp_health_sensitivity)
+					continue;
+
+				prop = genradix_ptr_alloc(&rlist->lgrl_list,
+							  rlist->lgrl_count++,
+							  GFP_ATOMIC);
+				if (!prop) {
+					rc = -ENOMEM;
+					goto failed_alloc;
+				}
+
+				prop->lrp_net = rnet->lrn_net;
+				prop->lrp_gateway = route->lr_nid;
+				prop->lrp_hop = route->lr_hops;
+				prop->lrp_priority = route->lr_priority;
+				prop->lrp_sensitivity =
+					route->lr_gateway->lp_health_sensitivity;
+				if (lnet_is_route_alive(route))
+					prop->lrp_flags |= LNET_RT_ALIVE;
+				else
+					prop->lrp_flags &= ~LNET_RT_ALIVE;
+				if (route->lr_single_hop)
+					prop->lrp_flags &= ~LNET_RT_MULTI_HOP;
+				else
+					prop->lrp_flags |= LNET_RT_MULTI_HOP;
+			}
+		}
+	}
+
+failed_alloc:
+	lnet_net_unlock(cpt);
+	return rc;
+}
+
+/* LNet route ->start() handler for GET requests */
+static int lnet_route_show_start(struct netlink_callback *cb)
+{
+	struct genlmsghdr *gnlh = nlmsg_data(cb->nlh);
+	struct netlink_ext_ack *extack = cb->extack;
+	struct lnet_genl_route_list *rlist;
+	int msg_len = genlmsg_len(gnlh);
+	int rc = 0;
+
+	if (the_lnet.ln_refcount == 0 ||
+	    the_lnet.ln_state != LNET_STATE_RUNNING) {
+		NL_SET_ERR_MSG(extack, "Network is down");
+		return -ENETDOWN;
+	}
+
+	rlist = kzalloc(sizeof(*rlist), GFP_KERNEL);
+	if (!rlist) {
+		NL_SET_ERR_MSG(extack, "No memory for route list");
+		return -ENOMEM;
+	}
+
+	genradix_init(&rlist->lgrl_list);
+	rlist->lgrl_count = 0;
+	rlist->lgrl_index = 0;
+	cb->args[0] = (long)rlist;
+
+	mutex_lock(&the_lnet.ln_api_mutex);
+	if (!msg_len) {
+		struct lnet_route_properties tmp = {
+			.lrp_gateway		= LNET_ANY_NID,
+			.lrp_net		= LNET_NET_ANY,
+			.lrp_hop		= -1,
+			.lrp_priority		= -1,
+			.lrp_sensitivity	= -1,
+		};
+
+		rc = lnet_scan_route(rlist, &tmp);
+		if (rc < 0) {
+			NL_SET_ERR_MSG(extack,
+				       "failed to allocate router data");
+			goto report_err;
+		}
+	} else {
+		struct nlattr *params = genlmsg_data(gnlh);
+		struct nlattr *attr;
+		int rem;
+
+		nla_for_each_nested(attr, params, rem) {
+			struct lnet_route_properties tmp = {
+				.lrp_gateway		= LNET_ANY_NID,
+				.lrp_net		= LNET_NET_ANY,
+				.lrp_hop		= -1,
+				.lrp_priority		= -1,
+				.lrp_sensitivity	= -1,
+			};
+			struct nlattr *route;
+			int rem2;
+
+			if (nla_type(attr) != LN_SCALAR_ATTR_LIST)
+				continue;
+
+			nla_for_each_nested(route, attr, rem2) {
+				if (nla_type(route) != LN_SCALAR_ATTR_VALUE)
+					continue;
+
+				if (nla_strcmp(route, "net") == 0) {
+					char nw[LNET_NIDSTR_SIZE];
+
+					route = nla_next(route, &rem2);
+					if (nla_type(route) !=
+					    LN_SCALAR_ATTR_VALUE) {
+						NL_SET_ERR_MSG(extack,
+							       "invalid net param");
+						rc = -EINVAL;
+						goto report_err;
+					}
+
+					rc = nla_strlcpy(nw, route, sizeof(nw));
+					if (rc < 0) {
+						NL_SET_ERR_MSG(extack,
+							       "failed to get route param");
+						goto report_err;
+					}
+					rc = 0;
+					tmp.lrp_net = libcfs_str2net(strim(nw));
+				} else if (nla_strcmp(route, "gateway") == 0) {
+					char gw[LNET_NIDSTR_SIZE];
+
+					route = nla_next(route, &rem2);
+					if (nla_type(route) !=
+					    LN_SCALAR_ATTR_VALUE) {
+						NL_SET_ERR_MSG(extack,
+							       "invalid gateway param");
+						rc = -EINVAL;
+						goto report_err;
+					}
+
+					rc = nla_strlcpy(gw, route, sizeof(gw));
+					if (rc < 0) {
+						NL_SET_ERR_MSG(extack,
+							       "failed to get route param");
+						goto report_err;
+					}
+					rc = 0;
+					libcfs_strnid(&tmp.lrp_gateway, strim(gw));
+				} else if (nla_strcmp(route, "hop") == 0) {
+					route = nla_next(route, &rem2);
+					if (nla_type(route) !=
+					    LN_SCALAR_ATTR_INT_VALUE) {
+						NL_SET_ERR_MSG(extack,
+							       "invalid hop param");
+						rc = -EINVAL;
+						goto report_err;
+					}
+
+					tmp.lrp_hop = nla_get_s64(route);
+					if (tmp.lrp_hop != -1)
+						clamp_t(s32, tmp.lrp_hop, 1, 127);
+				} else if (nla_strcmp(route, "priority") == 0) {
+					route = nla_next(route, &rem2);
+					if (nla_type(route) !=
+					    LN_SCALAR_ATTR_INT_VALUE) {
+						NL_SET_ERR_MSG(extack,
+							       "invalid priority param");
+						rc = -EINVAL;
+						goto report_err;
+					}
+
+					tmp.lrp_priority = nla_get_s64(route);
+				}
+			}
+
+			rc = lnet_scan_route(rlist, &tmp);
+			if (rc < 0) {
+				NL_SET_ERR_MSG(extack,
+					       "failed to allocate router data");
+				goto report_err;
+			}
+		}
+	}
+report_err:
+	mutex_unlock(&the_lnet.ln_api_mutex);
+
+	if (rc < 0)
+		lnet_route_show_done(cb);
+
+	return rc;
+}
+
+static const struct ln_key_list route_props_list = {
+	.lkl_maxattr			= LNET_ROUTE_ATTR_MAX,
+	.lkl_list			= {
+		[LNET_ROUTE_ATTR_HDR]			= {
+			.lkp_value			= "route",
+			.lkp_key_format			= LNKF_SEQUENCE | LNKF_MAPPING,
+			.lkp_data_type			= NLA_NUL_STRING,
+		},
+		[LNET_ROUTE_ATTR_NET]			= {
+			.lkp_value			= "net",
+			.lkp_data_type			= NLA_STRING
+		},
+		[LNET_ROUTE_ATTR_GATEWAY]		= {
+			.lkp_value			= "gateway",
+			.lkp_data_type			= NLA_STRING
+		},
+		[LNET_ROUTE_ATTR_HOP]			= {
+			.lkp_value			= "hop",
+			.lkp_data_type			= NLA_S32
+		},
+		[LNET_ROUTE_ATTR_PRIORITY]		= {
+			.lkp_value			= "priority",
+			.lkp_data_type			= NLA_U32
+		},
+		[LNET_ROUTE_ATTR_HEALTH_SENSITIVITY]	= {
+			.lkp_value			= "health_sensitivity",
+			.lkp_data_type			= NLA_U32
+		},
+		[LNET_ROUTE_ATTR_STATE]	= {
+			.lkp_value			= "state",
+			.lkp_data_type			= NLA_STRING,
+		},
+		[LNET_ROUTE_ATTR_TYPE]	= {
+			.lkp_value			= "type",
+			.lkp_data_type			= NLA_STRING,
+		},
+	},
+};
+
+static int lnet_route_show_dump(struct sk_buff *msg,
+				struct netlink_callback *cb)
+{
+	struct lnet_genl_route_list *rlist = lnet_route_dump_ctx(cb);
+	struct genlmsghdr *gnlh = nlmsg_data(cb->nlh);
+	struct netlink_ext_ack *extack = cb->extack;
+	int portid = NETLINK_CB(cb->skb).portid;
+	int seq = cb->nlh->nlmsg_seq;
+	int idx = rlist->lgrl_index;
+	int rc = 0;
+
+	if (!rlist->lgrl_count) {
+		NL_SET_ERR_MSG(extack, "No routes found");
+		rc = -ENOENT;
+		goto send_error;
+	}
+
+	if (!idx) {
+		const struct ln_key_list *all[] = {
+			&route_props_list, NULL
+		};
+
+		rc = lnet_genl_send_scalar_list(msg, portid, seq,
+						&lnet_family,
+						NLM_F_CREATE | NLM_F_MULTI,
+						LNET_CMD_ROUTES, all);
+		if (rc < 0) {
+			NL_SET_ERR_MSG(extack, "failed to send key table");
+			goto send_error;
+		}
+	}
+
+	/* If not routes found send an empty message and not an error */
+	if (!rlist->lgrl_count) {
+		void *hdr;
+
+		hdr = genlmsg_put(msg, portid, seq, &lnet_family,
+				  NLM_F_MULTI, LNET_CMD_ROUTES);
+		if (!hdr) {
+			NL_SET_ERR_MSG(extack, "failed to send values");
+			genlmsg_cancel(msg, hdr);
+			rc = -EMSGSIZE;
+			goto send_error;
+		}
+		genlmsg_end(msg, hdr);
+
+		goto send_error;
+	}
+
+	while (idx < rlist->lgrl_count) {
+		struct lnet_route_properties *prop;
+		void *hdr;
+
+		prop = genradix_ptr(&rlist->lgrl_list, idx++);
+
+		hdr = genlmsg_put(msg, portid, seq, &lnet_family,
+				  NLM_F_MULTI, LNET_CMD_ROUTES);
+		if (!hdr) {
+			NL_SET_ERR_MSG(extack, "failed to send values");
+			genlmsg_cancel(msg, hdr);
+			rc = -EMSGSIZE;
+			goto send_error;
+		}
+
+		if (idx == 1)
+			nla_put_string(msg, LNET_ROUTE_ATTR_HDR, "");
+
+		nla_put_string(msg, LNET_ROUTE_ATTR_NET,
+			       libcfs_net2str(prop->lrp_net));
+		nla_put_string(msg, LNET_ROUTE_ATTR_GATEWAY,
+			       libcfs_nidstr(&prop->lrp_gateway));
+		if (gnlh->version) {
+			nla_put_s32(msg, LNET_ROUTE_ATTR_HOP, prop->lrp_hop);
+			nla_put_u32(msg, LNET_ROUTE_ATTR_PRIORITY, prop->lrp_priority);
+			nla_put_u32(msg, LNET_ROUTE_ATTR_HEALTH_SENSITIVITY,
+				    prop->lrp_sensitivity);
+
+			nla_put_string(msg, LNET_ROUTE_ATTR_STATE,
+				       prop->lrp_flags & LNET_RT_ALIVE ?
+				       "up" : "down");
+			nla_put_string(msg, LNET_ROUTE_ATTR_TYPE,
+				       prop->lrp_flags & LNET_RT_MULTI_HOP ?
+				       "multi-hop" : "single-hop");
+		}
+		genlmsg_end(msg, hdr);
+	}
+	rlist->lgrl_index = idx;
+send_error:
+	return rc;
+};
+
 static inline struct lnet_genl_ping_list *
 lnet_ping_dump_ctx(struct netlink_callback *cb)
 {
@@ -5654,6 +6043,7 @@ static int lnet_ping_show_dump(struct sk_buff *msg,
 static const struct genl_multicast_group lnet_mcast_grps[] = {
 	{ .name	=	"ip2net",	},
 	{ .name =	"net",		},
+	{ .name	=	"route",	},
 	{ .name	=	"ping",		},
 };
 
@@ -5666,6 +6056,12 @@ static const struct genl_ops lnet_genl_ops[] = {
 		.done		= lnet_net_show_done,
 		.doit		= lnet_net_cmd,
 	},
+	{
+		.cmd		= LNET_CMD_ROUTES,
+		.start		= lnet_route_show_start,
+		.dumpit		= lnet_route_show_dump,
+		.done		= lnet_route_show_done,
+	},
 	{
 		.cmd		= LNET_CMD_PING,
 		.start		= lnet_ping_show_start,
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 22/33] lustre: ptlrpc: switch sptlrpc_rule_set_choose to large nid
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (20 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 21/33] lnet: collect data about routes by using Netlink James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 23/33] lnet: use list_first_entry() where appropriate James Simmons
                   ` (10 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown; +Cc: Lustre Development List

From: Mr NeilBrown <neilb@suse.de>

sptlrpc_rule_set_choose() and sptlrpc_target_choose_flavor() now take
a large nid.  Only the net number is needed, so this is quite straight
forward.

WC-bug-id: https://jira.whamcloud.com/browse/LU-10391
Lustre-commit: 80a4a2ebe0a269d56 ("LU-10391 ptlrpc: switch sptlrpc_rule_set_choose to large nid")
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50102
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/ptlrpc/sec_config.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/lustre/ptlrpc/sec_config.c b/fs/lustre/ptlrpc/sec_config.c
index 1b56ef40ebda..95e0da4b2da2 100644
--- a/fs/lustre/ptlrpc/sec_config.c
+++ b/fs/lustre/ptlrpc/sec_config.c
@@ -374,7 +374,7 @@ static int sptlrpc_rule_set_merge(struct sptlrpc_rule_set *rset,
 static int sptlrpc_rule_set_choose(struct sptlrpc_rule_set *rset,
 				   enum lustre_sec_part from,
 				   enum lustre_sec_part to,
-				   lnet_nid_t nid,
+				   struct lnet_nid *nid,
 				   struct sptlrpc_flavor *sf)
 {
 	struct sptlrpc_rule *r;
@@ -383,9 +383,9 @@ static int sptlrpc_rule_set_choose(struct sptlrpc_rule_set *rset,
 	for (n = 0; n < rset->srs_nrule; n++) {
 		r = &rset->srs_rules[n];
 
-		if (LNET_NIDNET(nid) != LNET_NET_ANY &&
+		if (!LNET_NID_IS_ANY(nid) &&
 		    r->sr_netid != LNET_NET_ANY &&
-		    LNET_NIDNET(nid) != r->sr_netid)
+		    __be16_to_cpu(nid->nid_num) != r->sr_netid)
 			continue;
 
 		if (from != LUSTRE_SP_ANY && r->sr_from != LUSTRE_SP_ANY &&
@@ -811,13 +811,13 @@ void sptlrpc_conf_choose_flavor(enum lustre_sec_part from,
 	conf_tgt = sptlrpc_conf_get_tgt(conf, name, 0);
 	if (conf_tgt) {
 		rc = sptlrpc_rule_set_choose(&conf_tgt->sct_rset, from, to,
-					     lnet_nid_to_nid4(nid), sf);
+					     nid, sf);
 		if (rc)
 			goto out;
 	}
 
 	rc = sptlrpc_rule_set_choose(&conf->sc_rset, from, to,
-				     lnet_nid_to_nid4(nid), sf);
+				     nid, sf);
 out:
 	mutex_unlock(&sptlrpc_conf_lock);
 
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 23/33] lnet: use list_first_entry() where appropriate.
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (21 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 22/33] lustre: ptlrpc: switch sptlrpc_rule_set_choose to large nid James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 24/33] lustre: statahead: using try lock for batched RPCs James Simmons
                   ` (9 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Arshad Hussain, Lustre Development List

From: Mr NeilBrown <neilb@suse.de>

Lustre already uses list_first_entry() in many places, but
it is not consistent.  Let's make it consistent.
The patch was generated with

sed -i 's/list_entry(([^,]*)->next,/list_first_entry(1,/'
        `git grep -l 'list_entry(.*->next' lustre/ lnet/ libcfs/ `

followed by some manual cleanup of indents.

WC-bug-id: https://jira.whamcloud.com/browse/LU-6142
Lustre-commit: 01e054b34cb894bd4 ("LU-6142 all: use list_first_entry() where appropriate.")
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50826
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 net/lnet/lnet/lib-move.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/lnet/lnet/lib-move.c b/net/lnet/lnet/lib-move.c
index 9d50260d917a..d9f5eb94ff6e 100644
--- a/net/lnet/lnet/lib-move.c
+++ b/net/lnet/lnet/lib-move.c
@@ -3162,8 +3162,8 @@ lnet_resend_pending_msgs_locked(struct list_head *resendq, int cpt)
 	while (!list_empty(resendq)) {
 		struct lnet_peer_ni *lpni;
 
-		msg = list_entry(resendq->next, struct lnet_msg,
-				 msg_list);
+		msg = list_first_entry(resendq, struct lnet_msg,
+				       msg_list);
 
 		list_del_init(&msg->msg_list);
 
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 24/33] lustre: statahead: using try lock for batched RPCs
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (22 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 23/33] lnet: use list_first_entry() where appropriate James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 25/33] lnet: libcfs: use round_up directly James Simmons
                   ` (8 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Mikhail Pershin, Lustre Development List

From: Qian Yingjin <qian@ddn.com>

In this patch, we set "statahead_batch_max" with 64 to enable
batched statahead by default.

WC-bug-id: https://jira.whamcloud.com/browse/LU-15562
Lustre-commit; 58549f9780418d548 ("LU-15562 statahead: using try lock for batched RPCs")
Signed-off-by: Qian Yingjin <qian@ddn.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/46549
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Mikhail Pershin <mpershin@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/llite/llite_internal.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/lustre/llite/llite_internal.h b/fs/lustre/llite/llite_internal.h
index 42f991ea9a7e..93743d27739c 100644
--- a/fs/lustre/llite/llite_internal.h
+++ b/fs/lustre/llite/llite_internal.h
@@ -1518,7 +1518,7 @@ void ll_ra_stats_inc(struct inode *inode, enum ra_stat which);
 /* statahead.c */
 
 #define LL_SA_RPC_MIN		8
-#define LL_SA_RPC_DEF		32
+#define LL_SA_RPC_DEF		128
 #define LL_SA_RPC_MAX		2048
 
 /* XXX: If want to support more concurrent statahead instances,
@@ -1530,7 +1530,7 @@ void ll_ra_stats_inc(struct inode *inode, enum ra_stat which);
 #define LL_SA_RUNNING_DEF	16
 
 #define LL_SA_BATCH_MAX		1024
-#define LL_SA_BATCH_DEF		0
+#define LL_SA_BATCH_DEF		64
 
 #define LL_SA_CACHE_BIT		5
 #define LL_SA_CACHE_SIZE	BIT(LL_SA_CACHE_BIT)
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 25/33] lnet: libcfs: use round_up directly
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (23 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 24/33] lustre: statahead: using try lock for batched RPCs James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 26/33] lustre: mdc: md_open_data should keep ref on close_req James Simmons
                   ` (7 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Arshad Hussain, Lustre Development List

The macro cfs_size_round() is just round_up(val, 8). Replace
cfs_size_round() with the Linux standard round_up().

WC-bug-id: https://jira.whamcloud.com/browse/LU-9859
Lustre-commit: 20683c0d6c3e7d042 ("LU-9859 libcfs: use round_up directly")
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50545
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
---
 fs/lustre/include/cl_object.h         |  2 +-
 fs/lustre/llite/vvp_object.c          |  2 +-
 fs/lustre/mdc/mdc_request.c           |  9 ++++-----
 fs/lustre/obdclass/class_obd.c        |  6 +++---
 fs/lustre/obdecho/echo_client.c       |  2 +-
 fs/lustre/osc/osc_cache.c             |  2 +-
 fs/lustre/ptlrpc/batch.c              |  6 ++----
 fs/lustre/ptlrpc/layout.c             |  8 +++++---
 fs/lustre/ptlrpc/pack_generic.c       | 13 ++++++-------
 include/linux/libcfs/libcfs_private.h |  4 ----
 net/lnet/libcfs/module.c              |  8 ++++----
 11 files changed, 28 insertions(+), 34 deletions(-)

diff --git a/fs/lustre/include/cl_object.h b/fs/lustre/include/cl_object.h
index 9d940cbdb249..b8ac31960a2f 100644
--- a/fs/lustre/include/cl_object.h
+++ b/fs/lustre/include/cl_object.h
@@ -2162,7 +2162,7 @@ static inline int cl_object_same(struct cl_object *o0, struct cl_object *o1)
 static inline void cl_object_page_init(struct cl_object *clob, int size)
 {
 	clob->co_slice_off = cl_object_header(clob)->coh_page_bufsize;
-	cl_object_header(clob)->coh_page_bufsize += cfs_size_round(size);
+	cl_object_header(clob)->coh_page_bufsize += round_up(size, 8);
 	WARN_ON(cl_object_header(clob)->coh_page_bufsize > 512);
 }
 
diff --git a/fs/lustre/llite/vvp_object.c b/fs/lustre/llite/vvp_object.c
index 5120ec095862..f4b2f8921b6c 100644
--- a/fs/lustre/llite/vvp_object.c
+++ b/fs/lustre/llite/vvp_object.c
@@ -316,7 +316,7 @@ struct lu_object *vvp_object_alloc(const struct lu_env *env,
 		obj = &vob->vob_cl.co_lu;
 		hdr = &vob->vob_header;
 		cl_object_header_init(hdr);
-		hdr->coh_page_bufsize = cfs_size_round(sizeof(struct cl_page));
+		hdr->coh_page_bufsize = round_up(sizeof(struct cl_page), 8);
 
 		lu_object_init(obj, &hdr->coh_lu, dev);
 		lu_object_add_top(&hdr->coh_lu, obj);
diff --git a/fs/lustre/mdc/mdc_request.c b/fs/lustre/mdc/mdc_request.c
index 5919e5952c0e..2b8386661a31 100644
--- a/fs/lustre/mdc/mdc_request.c
+++ b/fs/lustre/mdc/mdc_request.c
@@ -1712,15 +1712,14 @@ static int mdc_ioc_fid2path(struct obd_export *exp, struct getinfo_fid2path *gf)
 		return -EOVERFLOW;
 
 	/* Key is KEY_FID2PATH + getinfo_fid2path description */
-	keylen = cfs_size_round(sizeof(KEY_FID2PATH)) + sizeof(*gf) +
-				sizeof(struct lu_fid);
+	keylen = round_up(sizeof(KEY_FID2PATH) + sizeof(*gf) +
+			  sizeof(struct lu_fid), 8);
 	key = kzalloc(keylen, GFP_NOFS);
 	if (!key)
 		return -ENOMEM;
 	memcpy(key, KEY_FID2PATH, sizeof(KEY_FID2PATH));
-	memcpy(key + cfs_size_round(sizeof(KEY_FID2PATH)), gf, sizeof(*gf));
-
-	memcpy(key + cfs_size_round(sizeof(KEY_FID2PATH)) + sizeof(*gf),
+	memcpy(key + round_up(sizeof(KEY_FID2PATH), 8), gf, sizeof(*gf));
+	memcpy(key + round_up(sizeof(KEY_FID2PATH), 8) + sizeof(*gf),
 	       gf->gf_root_fid, sizeof(struct lu_fid));
 	CDEBUG(D_IOCTL, "path get " DFID " from %llu #%d\n",
 	       PFID(&gf->gf_fid), gf->gf_recno, gf->gf_linkno);
diff --git a/fs/lustre/obdclass/class_obd.c b/fs/lustre/obdclass/class_obd.c
index ab27cf23ca9a..a6e256484800 100644
--- a/fs/lustre/obdclass/class_obd.c
+++ b/fs/lustre/obdclass/class_obd.c
@@ -278,17 +278,17 @@ int obd_ioctl_getdata(struct obd_ioctl_data **datap, int *len, void __user *arg)
 
 	if (data->ioc_inllen1) {
 		data->ioc_inlbuf1 = &data->ioc_bulk[0];
-		offset += cfs_size_round(data->ioc_inllen1);
+		offset += round_up(data->ioc_inllen1, 8);
 	}
 
 	if (data->ioc_inllen2) {
 		data->ioc_inlbuf2 = &data->ioc_bulk[0] + offset;
-		offset += cfs_size_round(data->ioc_inllen2);
+		offset += round_up(data->ioc_inllen2, 8);
 	}
 
 	if (data->ioc_inllen3) {
 		data->ioc_inlbuf3 = &data->ioc_bulk[0] + offset;
-		offset += cfs_size_round(data->ioc_inllen3);
+		offset += round_up(data->ioc_inllen3, 8);
 	}
 
 	if (data->ioc_inllen4)
diff --git a/fs/lustre/obdecho/echo_client.c b/fs/lustre/obdecho/echo_client.c
index 220ceae89150..654bc3b7d351 100644
--- a/fs/lustre/obdecho/echo_client.c
+++ b/fs/lustre/obdecho/echo_client.c
@@ -294,7 +294,7 @@ static struct lu_object *echo_object_alloc(const struct lu_env *env,
 
 		obj = &echo_obj2cl(eco)->co_lu;
 		cl_object_header_init(hdr);
-		hdr->coh_page_bufsize = cfs_size_round(sizeof(struct cl_page));
+		hdr->coh_page_bufsize = round_up(sizeof(struct cl_page), 8);
 
 		lu_object_init(obj, &hdr->coh_lu, dev);
 		lu_object_add_top(&hdr->coh_lu, obj);
diff --git a/fs/lustre/osc/osc_cache.c b/fs/lustre/osc/osc_cache.c
index 691ebc0ad46a..f1f21c28765e 100644
--- a/fs/lustre/osc/osc_cache.c
+++ b/fs/lustre/osc/osc_cache.c
@@ -2302,7 +2302,7 @@ int osc_prep_async_page(struct osc_object *osc, struct osc_page *ops,
 	struct osc_async_page *oap = &ops->ops_oap;
 
 	if (!page)
-		return cfs_size_round(sizeof(*oap));
+		return round_up(sizeof(*oap), 8);
 
 	oap->oap_obj = osc;
 	oap->oap_page = page->cp_vmpage;
diff --git a/fs/lustre/ptlrpc/batch.c b/fs/lustre/ptlrpc/batch.c
index 77e3261862e0..753dfe3c15e8 100644
--- a/fs/lustre/ptlrpc/batch.c
+++ b/fs/lustre/ptlrpc/batch.c
@@ -132,14 +132,12 @@ static int batch_prep_update_req(struct batch_update_head *head,
 	struct batch_update_buffer *buf;
 	struct but_update_header *buh;
 	struct but_update_buffer *bub;
+	int repsize = head->buh_repsize;
 	int page_count = 0;
 	int total = 0;
-	int repsize;
 	int rc;
 
-	repsize = head->buh_repsize +
-		  cfs_size_round(offsetof(struct batch_update_reply,
-					  burp_repmsg[0]));
+	repsize += round_up(offsetof(struct batch_update_reply, burp_repmsg[0]), 8);
 	if (repsize < OUT_UPDATE_REPLY_SIZE)
 		repsize = OUT_UPDATE_REPLY_SIZE;
 
diff --git a/fs/lustre/ptlrpc/layout.c b/fs/lustre/ptlrpc/layout.c
index 3a9e83f5262b..64e0224ce496 100644
--- a/fs/lustre/ptlrpc/layout.c
+++ b/fs/lustre/ptlrpc/layout.c
@@ -2404,9 +2404,11 @@ u32 req_capsule_fmt_size(u32 magic, const struct req_format *fmt,
 	if (!size)
 		return size;
 
-	for (; i < fmt->rf_fields[loc].nr; ++i)
-		if (fmt->rf_fields[loc].d[i]->rmf_size != -1)
-			size += cfs_size_round(fmt->rf_fields[loc].d[i]->rmf_size);
+	for (; i < fmt->rf_fields[loc].nr; ++i) {
+		if (fmt->rf_fields[loc].d[i]->rmf_size == -1)
+			continue;
+		size += round_up(fmt->rf_fields[loc].d[i]->rmf_size, 8);
+	}
 	return size;
 }
 EXPORT_SYMBOL(req_capsule_fmt_size);
diff --git a/fs/lustre/ptlrpc/pack_generic.c b/fs/lustre/ptlrpc/pack_generic.c
index 61fd122e8e3f..cb7a8a39a380 100644
--- a/fs/lustre/ptlrpc/pack_generic.c
+++ b/fs/lustre/ptlrpc/pack_generic.c
@@ -55,8 +55,7 @@
 
 static inline u32 lustre_msg_hdr_size_v2(u32 count)
 {
-	return cfs_size_round(offsetof(struct lustre_msg_v2,
-				       lm_buflens[count]));
+	return round_up(offsetof(struct lustre_msg_v2, lm_buflens[count]), 8);
 }
 
 u32 lustre_msg_hdr_size(u32 magic, u32 count)
@@ -91,7 +90,7 @@ u32 lustre_msg_size_v2(int count, u32 *lengths)
 	LASSERT(count > 0);
 	size = lustre_msg_hdr_size_v2(count);
 	for (i = 0; i < count; i++)
-		size += cfs_size_round(lengths[i]);
+		size += round_up(lengths[i], 8);
 
 	return size;
 }
@@ -164,7 +163,7 @@ void lustre_init_msg_v2(struct lustre_msg_v2 *msg, int count, u32 *lens,
 
 		if (tmp)
 			memcpy(ptr, tmp, lens[i]);
-		ptr += cfs_size_round(lens[i]);
+		ptr += round_up(lens[i], 8);
 	}
 }
 EXPORT_SYMBOL(lustre_init_msg_v2);
@@ -376,7 +375,7 @@ void *lustre_msg_buf_v2(struct lustre_msg_v2 *m, u32 n, u32 min_size)
 
 	offset = lustre_msg_hdr_size_v2(bufcount);
 	for (i = 0; i < n; i++)
-		offset += cfs_size_round(m->lm_buflens[i]);
+		offset += round_up(m->lm_buflens[i], 8);
 
 	return (char *)m + offset;
 }
@@ -410,7 +409,7 @@ static int lustre_shrink_msg_v2(struct lustre_msg_v2 *msg, u32 segment,
 	if (move_data && msg->lm_bufcount > segment + 1) {
 		tail = lustre_msg_buf_v2(msg, segment + 1, 0);
 		for (n = segment + 1; n < msg->lm_bufcount; n++)
-			tail_len += cfs_size_round(msg->lm_buflens[n]);
+			tail_len += round_up(msg->lm_buflens[n], 8);
 	}
 
 	msg->lm_buflens[segment] = newlen;
@@ -562,7 +561,7 @@ static int lustre_unpack_msg_v2(struct lustre_msg_v2 *m, int len)
 	for (i = 0; i < m->lm_bufcount; i++) {
 		if (swabbed)
 			__swab32s(&m->lm_buflens[i]);
-		buflen = cfs_size_round(m->lm_buflens[i]);
+		buflen = round_up(m->lm_buflens[i], 8);
 		if (buflen < 0 || buflen > PTLRPC_MAX_BUFLEN) {
 			CERROR("buffer %d length %d is not valid\n", i, buflen);
 			return -EINVAL;
diff --git a/include/linux/libcfs/libcfs_private.h b/include/linux/libcfs/libcfs_private.h
index 86d135a65d81..7c0fb5a1c652 100644
--- a/include/linux/libcfs/libcfs_private.h
+++ b/include/linux/libcfs/libcfs_private.h
@@ -139,13 +139,9 @@ do {								\
 /* logical equivalence */
 #define equi(a, b) (!!(a) == !!(b))
 
-#ifndef HAVE_CFS_SIZE_ROUND
 static inline size_t cfs_size_round(int val)
 {
 	return round_up(val, 8);
 }
 
-#define HAVE_CFS_SIZE_ROUND
-#endif
-
 #endif
diff --git a/net/lnet/libcfs/module.c b/net/lnet/libcfs/module.c
index a126683354ac..17cb8e4b818f 100644
--- a/net/lnet/libcfs/module.c
+++ b/net/lnet/libcfs/module.c
@@ -72,8 +72,8 @@ static inline size_t libcfs_ioctl_packlen(struct libcfs_ioctl_data *data)
 {
 	size_t len = sizeof(*data);
 
-	len += cfs_size_round(data->ioc_inllen1);
-	len += cfs_size_round(data->ioc_inllen2);
+	len += round_up(data->ioc_inllen1, 8);
+	len += round_up(data->ioc_inllen2, 8);
 	return len;
 }
 
@@ -124,7 +124,7 @@ static inline bool libcfs_ioctl_is_invalid(struct libcfs_ioctl_data *data)
 		return true;
 	}
 	if (data->ioc_inllen2 &&
-	    data->ioc_bulk[cfs_size_round(data->ioc_inllen1) +
+	    data->ioc_bulk[round_up(data->ioc_inllen1, 8) +
 			   data->ioc_inllen2 - 1] != '\0') {
 		CERROR("LIBCFS ioctl: inlbuf2 not 0 terminated\n");
 		return true;
@@ -144,7 +144,7 @@ static int libcfs_ioctl_data_adjust(struct libcfs_ioctl_data *data)
 
 	if (data->ioc_inllen2)
 		data->ioc_inlbuf2 = &data->ioc_bulk[0] +
-			cfs_size_round(data->ioc_inllen1);
+				    round_up(data->ioc_inllen1, 8);
 
 	return 0;
 }
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 26/33] lustre: mdc: md_open_data should keep ref on close_req
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (24 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 25/33] lnet: libcfs: use round_up directly James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 27/33] lustre: llite: update comment of ll_swap_layouts_close James Simmons
                   ` (6 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Lai Siyao, Li Dongyang, Lustre Development List

From: Li Dongyang <dongyangli@ddn.com>

md_open_data should keep a ref on mod_close_req,
otherwise the mod_close_req could be freed before
we try to access mod_close_req via md_open_data.

WC-bug-id: https://jira.whamcloud.com/browse/LU-16745
Lustre-commit: ca716f763f89af192 ("LU-16745 mdc: md_open_data should keep ref on close_req")
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50656
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/include/obd.h     | 2 ++
 fs/lustre/mdc/mdc_request.c | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/fs/lustre/include/obd.h b/fs/lustre/include/obd.h
index c62d9171150a..604739ca92c2 100644
--- a/fs/lustre/include/obd.h
+++ b/fs/lustre/include/obd.h
@@ -1188,6 +1188,8 @@ static inline struct md_open_data *obd_mod_alloc(void)
 	if (atomic_dec_and_test(&(mod)->mod_refcount)) {		\
 		if ((mod)->mod_open_req)				\
 			ptlrpc_req_finished((mod)->mod_open_req);	\
+		if ((mod)->mod_close_req)				\
+			ptlrpc_req_finished((mod)->mod_close_req);	\
 		kfree(mod);						\
 	}								\
 })
diff --git a/fs/lustre/mdc/mdc_request.c b/fs/lustre/mdc/mdc_request.c
index 2b8386661a31..3b838bceba39 100644
--- a/fs/lustre/mdc/mdc_request.c
+++ b/fs/lustre/mdc/mdc_request.c
@@ -1033,12 +1033,16 @@ static int mdc_close(struct obd_export *exp, struct md_op_data *op_data,
 	if (mod) {
 		if (rc != 0)
 			mod->mod_close_req = NULL;
+		if (mod->mod_close_req)
+			ptlrpc_request_addref(mod->mod_close_req);
+
 		/* Since now, mod is accessed through open_req only,
 		 * thus close req does not keep a reference on mod anymore.
 		 */
 		obd_mod_put(mod);
 	}
 	*request = req;
+
 	return rc < 0 ? rc : saved_rc;
 }
 
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 27/33] lustre: llite: update comment of ll_swap_layouts_close
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (25 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 26/33] lustre: mdc: md_open_data should keep ref on close_req James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 28/33] lustre: ldlm: replace OBD_ -> CFS_ macros James Simmons
                   ` (5 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown; +Cc: Li Xi, Lustre Development List

From: Li Xi <lixi@ddn.com>

mdc_close_layout_swap_pack() does not exist, and the lease lock
handle is release in mdc_close_intent_pack(). This patch updates
the comment.

WC-bug-id: https://jira.whamcloud.com/browse/LU-16748
Lustre-commit: cfef0d9d5e708d534 ("LU-16748 llite: update comment of ll_swap_layouts_close")
Signed-off-by: Li Xi <lixi@ddn.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50660
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/llite/file.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/lustre/llite/file.c b/fs/lustre/llite/file.c
index e745dc8c53a5..7899ffdd92fb 100644
--- a/fs/lustre/llite/file.c
+++ b/fs/lustre/llite/file.c
@@ -1324,9 +1324,8 @@ static int ll_swap_layouts_close(struct obd_client_handle *och,
 		goto out_free_och;
 	}
 
-	/*
-	 * Close the file and {swap,merge} layouts between inode & inode2.
-	 * NB: lease lock handle is released in mdc_close_layout_swap_pack()
+	/* Close the file and {swap,merge} layouts between inode & inode2.
+	 * NB: local lease handle is released in mdc_close_intent_pack()
 	 * because we still need it to pack l_remote_handle to MDT.
 	 */
 	rc = ll_close_inode_openhandle(inode, och, MDS_CLOSE_LAYOUT_SWAP,
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 28/33] lustre: ldlm: replace OBD_ -> CFS_ macros
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (26 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 27/33] lustre: llite: update comment of ll_swap_layouts_close James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 29/33] lustre: mdc: remove " James Simmons
                   ` (4 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Arshad Hussain, Lustre Development List

From: Timothy Day <timday@amazon.com>

Replace OBD macros that are simply redefinitions
of CFS macros.

WC-bug-id: https://jira.whamcloud.com/browse/LU-12610
Lustre-commit: 5770020076b339f82 ("LU-12610 ldlm: replace OBD_ -> CFS_ macros")
Signed-off-by: Timothy Day <timday@amazon.com>
Signed-off-by: Ben Evans <beevans@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50685
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/ldlm/ldlm_extent.c   |  2 +-
 fs/lustre/ldlm/ldlm_flock.c    | 16 ++++++++--------
 fs/lustre/ldlm/ldlm_lib.c      |  4 ++--
 fs/lustre/ldlm/ldlm_lock.c     |  6 +++---
 fs/lustre/ldlm/ldlm_lockd.c    | 18 +++++++++---------
 fs/lustre/ldlm/ldlm_request.c  |  8 ++++----
 fs/lustre/ldlm/ldlm_resource.c |  2 +-
 7 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/fs/lustre/ldlm/ldlm_extent.c b/fs/lustre/ldlm/ldlm_extent.c
index 4533bdbe7fb1..15ce512cf10c 100644
--- a/fs/lustre/ldlm/ldlm_extent.c
+++ b/fs/lustre/ldlm/ldlm_extent.c
@@ -168,7 +168,7 @@ void ldlm_extent_add_lock(struct ldlm_resource *res,
 	 */
 	ldlm_resource_add_lock(res, &res->lr_granted, lock);
 
-	if (OBD_FAIL_CHECK(OBD_FAIL_LDLM_GRANT_CHECK)) {
+	if (CFS_FAIL_CHECK(OBD_FAIL_LDLM_GRANT_CHECK)) {
 		struct ldlm_lock *lck;
 
 		list_for_each_entry_reverse(lck, &res->lr_granted,
diff --git a/fs/lustre/ldlm/ldlm_flock.c b/fs/lustre/ldlm/ldlm_flock.c
index 4ca69f8c51e4..4906a075e63a 100644
--- a/fs/lustre/ldlm/ldlm_flock.c
+++ b/fs/lustre/ldlm/ldlm_flock.c
@@ -315,12 +315,12 @@ ldlm_flock_completion_ast(struct ldlm_lock *lock, u64 flags, void *data)
 	struct file_lock *getlk = lock->l_ast_data;
 	int rc = 0;
 
-	OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_CP_CB_WAIT2, 4);
-	if (OBD_FAIL_PRECHECK(OBD_FAIL_LDLM_CP_CB_WAIT3)) {
+	CFS_FAIL_TIMEOUT(OBD_FAIL_LDLM_CP_CB_WAIT2, 4);
+	if (CFS_FAIL_PRECHECK(OBD_FAIL_LDLM_CP_CB_WAIT3)) {
 		lock_res_and_lock(lock);
 		lock->l_flags |= LDLM_FL_FAIL_LOC;
 		unlock_res_and_lock(lock);
-		OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_CP_CB_WAIT3, 4);
+		CFS_FAIL_TIMEOUT(OBD_FAIL_LDLM_CP_CB_WAIT3, 4);
 	}
 	CDEBUG(D_DLMTRACE, "flags: 0x%llx data: %p getlk: %p\n",
 	       flags, data, getlk);
@@ -360,22 +360,22 @@ ldlm_flock_completion_ast(struct ldlm_lock *lock, u64 flags, void *data)
 	}
 
 granted:
-	OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_CP_CB_WAIT, 10);
+	CFS_FAIL_TIMEOUT(OBD_FAIL_LDLM_CP_CB_WAIT, 10);
 
-	if (OBD_FAIL_PRECHECK(OBD_FAIL_LDLM_CP_CB_WAIT4)) {
+	if (CFS_FAIL_PRECHECK(OBD_FAIL_LDLM_CP_CB_WAIT4)) {
 		lock_res_and_lock(lock);
 		/* DEADLOCK is always set with CBPENDING */
 		lock->l_flags |= LDLM_FL_FLOCK_DEADLOCK | LDLM_FL_CBPENDING;
 		unlock_res_and_lock(lock);
-		OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_CP_CB_WAIT4, 4);
+		CFS_FAIL_TIMEOUT(OBD_FAIL_LDLM_CP_CB_WAIT4, 4);
 	}
-	if (OBD_FAIL_PRECHECK(OBD_FAIL_LDLM_CP_CB_WAIT5)) {
+	if (CFS_FAIL_PRECHECK(OBD_FAIL_LDLM_CP_CB_WAIT5)) {
 		lock_res_and_lock(lock);
 		/* DEADLOCK is always set with CBPENDING */
 		lock->l_flags |= LDLM_FL_FAIL_LOC |
 				 LDLM_FL_FLOCK_DEADLOCK | LDLM_FL_CBPENDING;
 		unlock_res_and_lock(lock);
-		OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_CP_CB_WAIT5, 4);
+		CFS_FAIL_TIMEOUT(OBD_FAIL_LDLM_CP_CB_WAIT5, 4);
 	}
 
 	lock_res_and_lock(lock);
diff --git a/fs/lustre/ldlm/ldlm_lib.c b/fs/lustre/ldlm/ldlm_lib.c
index 726f70c43e19..c9a10f0d87ea 100644
--- a/fs/lustre/ldlm/ldlm_lib.c
+++ b/fs/lustre/ldlm/ldlm_lib.c
@@ -753,7 +753,7 @@ EXPORT_SYMBOL(target_pack_pool_reply);
 static int
 target_send_reply_msg(struct ptlrpc_request *req, int rc, int fail_id)
 {
-	if (OBD_FAIL_CHECK_ORSET(fail_id & ~OBD_FAIL_ONCE, OBD_FAIL_ONCE)) {
+	if (CFS_FAIL_CHECK_ORSET(fail_id & ~CFS_FAIL_ONCE, CFS_FAIL_ONCE)) {
 		DEBUG_REQ(D_ERROR, req, "dropping reply");
 		return -ECOMM;
 	}
@@ -763,7 +763,7 @@ target_send_reply_msg(struct ptlrpc_request *req, int rc, int fail_id)
 	 */
 	if (req->rq_reqmsg &&
 	    unlikely(lustre_msg_get_opc(req->rq_reqmsg) == MDS_REINT &&
-	    OBD_FAIL_CHECK(OBD_FAIL_MDS_REINT_MULTI_NET_REP)))
+	    CFS_FAIL_CHECK(OBD_FAIL_MDS_REINT_MULTI_NET_REP)))
 		return -ECOMM;
 
 	if (unlikely(rc)) {
diff --git a/fs/lustre/ldlm/ldlm_lock.c b/fs/lustre/ldlm/ldlm_lock.c
index 8659aa5c0cc8..5fcae3864483 100644
--- a/fs/lustre/ldlm/ldlm_lock.c
+++ b/fs/lustre/ldlm/ldlm_lock.c
@@ -790,7 +790,7 @@ void ldlm_lock_decref_internal(struct ldlm_lock *lock, enum ldlm_mode mode)
 		unlock_res_and_lock(lock);
 
 		if (ldlm_is_fail_loc(lock))
-			OBD_RACE(OBD_FAIL_LDLM_CP_BL_RACE);
+			CFS_RACE(OBD_FAIL_LDLM_CP_BL_RACE);
 
 		if (ldlm_is_atomic_cb(lock) ||
 		    ldlm_bl_to_thread_lock(ns, NULL, lock) != 0)
@@ -806,7 +806,7 @@ void ldlm_lock_decref_internal(struct ldlm_lock *lock, enum ldlm_mode mode)
 		LDLM_DEBUG(lock, "add lock into lru list");
 
 		if (ldlm_is_fail_loc(lock))
-			OBD_RACE(OBD_FAIL_LDLM_CP_BL_RACE);
+			CFS_RACE(OBD_FAIL_LDLM_CP_BL_RACE);
 
 		ldlm_pool_recalc(&ns->ns_pool, true);
 	} else {
@@ -1588,7 +1588,7 @@ struct ldlm_lock *ldlm_lock_create(struct ldlm_namespace *ns,
 	}
 
 	lock->l_lvb_type = lvb_type;
-	if (OBD_FAIL_CHECK(OBD_FAIL_LDLM_NEW_LOCK)) {
+	if (CFS_FAIL_CHECK(OBD_FAIL_LDLM_NEW_LOCK)) {
 		rc = -ENOENT;
 		goto out;
 	}
diff --git a/fs/lustre/ldlm/ldlm_lockd.c b/fs/lustre/ldlm/ldlm_lockd.c
index abd853babe1b..a839ff2177d1 100644
--- a/fs/lustre/ldlm/ldlm_lockd.c
+++ b/fs/lustre/ldlm/ldlm_lockd.c
@@ -218,7 +218,7 @@ static int ldlm_handle_cp_callback(struct ptlrpc_request *req,
 
 	LDLM_DEBUG(lock, "client completion callback handler START");
 
-	if (OBD_FAIL_CHECK(OBD_FAIL_LDLM_CANCEL_BL_CB_RACE)) {
+	if (CFS_FAIL_CHECK(OBD_FAIL_LDLM_CANCEL_BL_CB_RACE)) {
 		long to = HZ;
 
 		ldlm_callback_reply(req, 0);
@@ -328,7 +328,7 @@ static int ldlm_handle_cp_callback(struct ptlrpc_request *req,
 	LDLM_DEBUG(lock, "callback handler finished, about to run_ast_work");
 
 	/* Let Enqueue to call osc_lock_upcall() and initialize l_ast_data */
-	OBD_FAIL_TIMEOUT(OBD_FAIL_OSC_CP_ENQ_RACE, 2);
+	CFS_FAIL_TIMEOUT(OBD_FAIL_OSC_CP_ENQ_RACE, 2);
 
 	ldlm_run_ast_work(ns, &ast_list, LDLM_WORK_CP_AST);
 
@@ -625,18 +625,18 @@ static int ldlm_callback_handler(struct ptlrpc_request *req)
 
 	switch (lustre_msg_get_opc(req->rq_reqmsg)) {
 	case LDLM_BL_CALLBACK:
-		if (OBD_FAIL_CHECK(OBD_FAIL_LDLM_BL_CALLBACK_NET)) {
+		if (CFS_FAIL_CHECK(OBD_FAIL_LDLM_BL_CALLBACK_NET)) {
 			if (cfs_fail_err)
 				ldlm_callback_reply(req, -(int)cfs_fail_err);
 			return 0;
 		}
 		break;
 	case LDLM_CP_CALLBACK:
-		if (OBD_FAIL_CHECK(OBD_FAIL_LDLM_CP_CALLBACK_NET))
+		if (CFS_FAIL_CHECK(OBD_FAIL_LDLM_CP_CALLBACK_NET))
 			return 0;
 		break;
 	case LDLM_GL_CALLBACK:
-		if (OBD_FAIL_CHECK(OBD_FAIL_LDLM_GL_CALLBACK_NET))
+		if (CFS_FAIL_CHECK(OBD_FAIL_LDLM_GL_CALLBACK_NET))
 			return 0;
 		break;
 	case LDLM_SET_INFO:
@@ -667,7 +667,7 @@ static int ldlm_callback_handler(struct ptlrpc_request *req)
 	 * Force a known safe race, send a cancel to the server for a lock
 	 * which the server has already started a blocking callback on.
 	 */
-	if (OBD_FAIL_CHECK(OBD_FAIL_LDLM_CANCEL_BL_CB_RACE) &&
+	if (CFS_FAIL_CHECK(OBD_FAIL_LDLM_CANCEL_BL_CB_RACE) &&
 	    lustre_msg_get_opc(req->rq_reqmsg) == LDLM_BL_CALLBACK) {
 		rc = ldlm_cli_cancel(&dlm_req->lock_handle[0], 0);
 		if (rc < 0)
@@ -687,7 +687,7 @@ static int ldlm_callback_handler(struct ptlrpc_request *req)
 
 	if (ldlm_is_fail_loc(lock) &&
 	    lustre_msg_get_opc(req->rq_reqmsg) == LDLM_BL_CALLBACK)
-		OBD_RACE(OBD_FAIL_LDLM_CP_BL_RACE);
+		CFS_RACE(OBD_FAIL_LDLM_CP_BL_RACE);
 
 	/* Copy hints/flags (e.g. LDLM_FL_DISCARD_DATA) from AST. */
 	lock_res_and_lock(lock);
@@ -751,7 +751,7 @@ static int ldlm_callback_handler(struct ptlrpc_request *req)
 		LDLM_DEBUG(lock, "completion ast\n");
 		req_capsule_extend(&req->rq_pill, &RQF_LDLM_CP_CALLBACK);
 		rc = ldlm_handle_cp_callback(req, ns, dlm_req, lock);
-		if (!OBD_FAIL_CHECK(OBD_FAIL_LDLM_CANCEL_BL_CB_RACE))
+		if (!CFS_FAIL_CHECK(OBD_FAIL_LDLM_CANCEL_BL_CB_RACE))
 			ldlm_callback_reply(req, rc);
 		break;
 	case LDLM_GL_CALLBACK:
@@ -879,7 +879,7 @@ static int ldlm_bl_thread_blwi(struct ldlm_bl_pool *blp,
 	if (blwi->blwi_mem_pressure)
 		flags = memalloc_noreclaim_save();
 
-	OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_PAUSE_CANCEL2, 4);
+	CFS_FAIL_TIMEOUT(OBD_FAIL_LDLM_PAUSE_CANCEL2, 4);
 
 	if (blwi->blwi_count) {
 		int count;
diff --git a/fs/lustre/ldlm/ldlm_request.c b/fs/lustre/ldlm/ldlm_request.c
index 57cf1c075b04..bccce8b8e5e8 100644
--- a/fs/lustre/ldlm/ldlm_request.c
+++ b/fs/lustre/ldlm/ldlm_request.c
@@ -270,7 +270,7 @@ int ldlm_completion_ast(struct ldlm_lock *lock, u64 flags, void *data)
 		conn_cnt = imp->imp_conn_cnt;
 		spin_unlock(&imp->imp_lock);
 	}
-	if (OBD_FAIL_CHECK_RESET(OBD_FAIL_LDLM_INTR_CP_AST,
+	if (CFS_FAIL_CHECK_RESET(OBD_FAIL_LDLM_INTR_CP_AST,
 				 OBD_FAIL_LDLM_CP_BL_RACE | OBD_FAIL_ONCE)) {
 		ldlm_set_fail_loc(lock);
 		rc = -EINTR;
@@ -1026,7 +1026,7 @@ static u64 ldlm_cli_cancel_local(struct ldlm_lock *lock)
 		bool local_only;
 
 		LDLM_DEBUG(lock, "client-side cancel");
-		OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_PAUSE_CANCEL_LOCAL,
+		CFS_FAIL_TIMEOUT(OBD_FAIL_LDLM_PAUSE_CANCEL_LOCAL,
 				 cfs_fail_val);
 
 		/* Set this flag to prevent others from getting new references*/
@@ -1360,7 +1360,7 @@ int ldlm_cli_cancel(const struct lustre_handle *lockh,
 	unlock_res_and_lock(lock);
 
 	if (flags & LCF_LOCAL)
-		OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_LOCAL_CANCEL_PAUSE,
+		CFS_FAIL_TIMEOUT(OBD_FAIL_LDLM_LOCAL_CANCEL_PAUSE,
 				 cfs_fail_val);
 
 	rc = ldlm_cli_cancel_local(lock);
@@ -2328,7 +2328,7 @@ static void ldlm_cancel_unused_locks_for_replay(struct ldlm_namespace *ns)
 	       "Dropping as many unused locks as possible before replay for namespace %s (%d)\n",
 	       ldlm_ns_name(ns), ns->ns_nr_unused);
 
-	OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_REPLAY_PAUSE, cfs_fail_val);
+	CFS_FAIL_TIMEOUT(OBD_FAIL_LDLM_REPLAY_PAUSE, cfs_fail_val);
 
 	/*
 	 * We don't need to care whether or not LRU resize is enabled
diff --git a/fs/lustre/ldlm/ldlm_resource.c b/fs/lustre/ldlm/ldlm_resource.c
index 28f64b6c0c04..7da47976e994 100644
--- a/fs/lustre/ldlm/ldlm_resource.c
+++ b/fs/lustre/ldlm/ldlm_resource.c
@@ -1170,7 +1170,7 @@ ldlm_resource_get(struct ldlm_namespace *ns, const struct ldlm_res_id *name,
 
 	cfs_hash_bd_unlock(ns->ns_rs_hash, &bd, 1);
 
-	OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_CREATE_RESOURCE, 2);
+	CFS_FAIL_TIMEOUT(OBD_FAIL_LDLM_CREATE_RESOURCE, 2);
 
 	/* Let's see if we happened to be the very first resource in this
 	 * namespace. If so, and this is a client namespace, we need to move
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 29/33] lustre: mdc: remove OBD_ -> CFS_ macros
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (27 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 28/33] lustre: ldlm: replace OBD_ -> CFS_ macros James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 30/33] lnet: libcfs: move cfs_expr_list_print to nidstrings.c James Simmons
                   ` (3 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Arshad Hussain, Lustre Development List

From: Timothy Day <timday@amazon.com>

Remove OBD macros that are simply redefinitions
of CFS macros.

WC-bug-id: https://jira.whamcloud.com/browse/LU-12610
Lustre-commit: 32aff098ce016fb56 ("LU-12610 mdt: remove OBD_ -> CFS_ macros")
Signed-off-by: Timothy Day <timday@amazon.com>
Signed-off-by: Ben Evans <beevans@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50806
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/mdc/mdc_dev.c     | 8 ++++----
 fs/lustre/mdc/mdc_locks.c   | 4 ++--
 fs/lustre/mdc/mdc_request.c | 2 +-
 fs/lustre/mgc/mgc_request.c | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/lustre/mdc/mdc_dev.c b/fs/lustre/mdc/mdc_dev.c
index a205a8de3249..eccd9819ca56 100644
--- a/fs/lustre/mdc/mdc_dev.c
+++ b/fs/lustre/mdc/mdc_dev.c
@@ -657,10 +657,10 @@ int mdc_enqueue_interpret(const struct lu_env *env, struct ptlrpc_request *req,
 	ldlm_lock_addref(lockh, mode);
 
 	/* Let cl_lock_state_wait fail with -ERESTARTSYS to unuse sublocks. */
-	OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_ENQUEUE_HANG, 2);
+	CFS_FAIL_TIMEOUT(OBD_FAIL_LDLM_ENQUEUE_HANG, 2);
 
 	/* Let CP AST to grant the lock first. */
-	OBD_FAIL_TIMEOUT(OBD_FAIL_OSC_CP_ENQ_RACE, 1);
+	CFS_FAIL_TIMEOUT(OBD_FAIL_OSC_CP_ENQ_RACE, 1);
 
 	/* Complete obtaining the lock procedure. */
 	rc = ldlm_cli_enqueue_fini(aa->oa_exp, &req->rq_pill, &einfo, 1,
@@ -670,7 +670,7 @@ int mdc_enqueue_interpret(const struct lu_env *env, struct ptlrpc_request *req,
 	rc = mdc_enqueue_fini(aa->oa_exp, req, aa->oa_upcall, aa->oa_cookie,
 			      lockh, mode, aa->oa_flags, rc);
 
-	OBD_FAIL_TIMEOUT(OBD_FAIL_OSC_CP_CANCEL_RACE, 10);
+	CFS_FAIL_TIMEOUT(OBD_FAIL_OSC_CP_CANCEL_RACE, 10);
 
 	ldlm_lock_decref(lockh, mode);
 	LDLM_LOCK_PUT(lock);
@@ -724,7 +724,7 @@ int mdc_enqueue_send(const struct lu_env *env, struct obd_export *exp,
 
 		matched = ldlm_handle2lock(&lockh);
 
-		if (OBD_FAIL_CHECK(OBD_FAIL_MDC_GLIMPSE_DDOS))
+		if (CFS_FAIL_CHECK(OBD_FAIL_MDC_GLIMPSE_DDOS))
 			ldlm_set_kms_ignore(matched);
 
 		if (mdc_set_dom_lock_data(matched, einfo->ei_cbdata)) {
diff --git a/fs/lustre/mdc/mdc_locks.c b/fs/lustre/mdc/mdc_locks.c
index 7695c78dc1bd..3b4c21354070 100644
--- a/fs/lustre/mdc/mdc_locks.c
+++ b/fs/lustre/mdc/mdc_locks.c
@@ -1150,7 +1150,7 @@ static int mdc_finish_intent_lock(struct obd_export *exp,
 		/* balanced in ll_file_open */
 		ptlrpc_request_addref(request);
 		/* eviction in middle of open RPC processing b=11546 */
-		OBD_FAIL_TIMEOUT(OBD_FAIL_MDC_ENQUEUE_PAUSE,
+		CFS_FAIL_TIMEOUT(OBD_FAIL_MDC_ENQUEUE_PAUSE,
 				 obd_timeout);
 	}
 
@@ -1373,7 +1373,7 @@ static int mdc_intent_getattr_async_interpret(const struct lu_env *env,
 	struct ldlm_reply *lockrep;
 	u64 flags = LDLM_FL_HAS_INTENT;
 
-	if (OBD_FAIL_CHECK(OBD_FAIL_MDC_GETATTR_ENQUEUE))
+	if (CFS_FAIL_CHECK(OBD_FAIL_MDC_GETATTR_ENQUEUE))
 		rc = -ETIMEDOUT;
 
 	rc = ldlm_cli_enqueue_fini(exp, pill, einfo, 1, &flags, NULL, 0,
diff --git a/fs/lustre/mdc/mdc_request.c b/fs/lustre/mdc/mdc_request.c
index 3b838bceba39..b9b962c6f723 100644
--- a/fs/lustre/mdc/mdc_request.c
+++ b/fs/lustre/mdc/mdc_request.c
@@ -929,7 +929,7 @@ static int mdc_close(struct obd_export *exp, struct md_op_data *op_data,
 	}
 
 	*request = NULL;
-	if (OBD_FAIL_CHECK(OBD_FAIL_MDC_CLOSE))
+	if (CFS_FAIL_CHECK(OBD_FAIL_MDC_CLOSE))
 		req = NULL;
 	else
 		req = ptlrpc_request_alloc(class_exp2cliimp(exp), req_fmt);
diff --git a/fs/lustre/mgc/mgc_request.c b/fs/lustre/mgc/mgc_request.c
index 94e15f9e7c52..56fb50aedbd9 100644
--- a/fs/lustre/mgc/mgc_request.c
+++ b/fs/lustre/mgc/mgc_request.c
@@ -1605,7 +1605,7 @@ int mgc_process_log(struct obd_device *mgc, struct config_llog_data *cld)
 		return 0;
 	}
 
-	OBD_FAIL_TIMEOUT(OBD_FAIL_MGC_PAUSE_PROCESS_LOG, 20);
+	CFS_FAIL_TIMEOUT(OBD_FAIL_MGC_PAUSE_PROCESS_LOG, 20);
 
 	CDEBUG(D_MGC, "Process log %s:%p from %d\n", cld->cld_logname,
 	       cld->cld_cfg.cfg_instance, cld->cld_cfg.cfg_last_idx + 1);
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 30/33] lnet: libcfs: move cfs_expr_list_print to nidstrings.c
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (28 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 29/33] lustre: mdc: remove " James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 31/33] lnet: libcfs: Remove reference to LASSERT_ATOMIC_POS James Simmons
                   ` (2 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown; +Cc: Lustre Development List

From: Mr NeilBrown <neilb@suse.de>

cfs_expr_list_print() is only called from nidstrings.c
so move it there and make it static.

WC-bug-id: https://jira.whamcloud.com/browse/LU-9859
Lustre-commit: 531d7b630e962a33f ("LU-9859 libcfs: move cfs_expr_list_print to nidstrings.c")
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50834
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 include/linux/libcfs/libcfs_string.h |  2 -
 net/lnet/libcfs/libcfs_string.c      | 68 ----------------------------
 net/lnet/lnet/nidstrings.c           | 68 ++++++++++++++++++++++++++++
 3 files changed, 68 insertions(+), 70 deletions(-)

diff --git a/include/linux/libcfs/libcfs_string.h b/include/linux/libcfs/libcfs_string.h
index a8bd44dc33d9..7673a2fecf7e 100644
--- a/include/linux/libcfs/libcfs_string.h
+++ b/include/linux/libcfs/libcfs_string.h
@@ -79,8 +79,6 @@ int cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res);
 int cfs_str2num_check(char *str, int nob, unsigned int *num,
 		      unsigned int min, unsigned int max);
 int cfs_expr_list_match(u32 value, struct cfs_expr_list *expr_list);
-int cfs_expr_list_print(char *buffer, int count,
-			struct cfs_expr_list *expr_list);
 int cfs_expr_list_values(struct cfs_expr_list *expr_list,
 			 int max, u32 **values);
 void cfs_expr_list_free(struct cfs_expr_list *expr_list);
diff --git a/net/lnet/libcfs/libcfs_string.c b/net/lnet/libcfs/libcfs_string.c
index 672b8591c50f..811b16d0f48d 100644
--- a/net/lnet/libcfs/libcfs_string.c
+++ b/net/lnet/libcfs/libcfs_string.c
@@ -305,74 +305,6 @@ cfs_range_expr_parse(struct cfs_lstr *src, unsigned int min, unsigned int max,
 	return -EINVAL;
 }
 
-/**
- * Print the range expression @expr into specified @buffer.
- * If @bracketed is true, expression does not need additional
- * brackets.
- *
- * Return:	number of characters written
- */
-static int
-cfs_range_expr_print(char *buffer, int count, struct cfs_range_expr *expr,
-		     bool bracketed)
-{
-	int i;
-	char s[] = "[";
-	char e[] = "]";
-
-	if (bracketed) {
-		s[0] = '\0';
-		e[0] = '\0';
-	}
-
-	if (expr->re_lo == expr->re_hi)
-		i = scnprintf(buffer, count, "%u", expr->re_lo);
-	else if (expr->re_stride == 1)
-		i = scnprintf(buffer, count, "%s%u-%u%s",
-			      s, expr->re_lo, expr->re_hi, e);
-	else
-		i = scnprintf(buffer, count, "%s%u-%u/%u%s",
-			      s, expr->re_lo, expr->re_hi, expr->re_stride, e);
-	return i;
-}
-
-/**
- * Print a list of range expressions (@expr_list) into specified @buffer.
- * If the list contains several expressions, separate them with comma
- * and surround the list with brackets.
- *
- * Return:	number of characters written
- */
-int
-cfs_expr_list_print(char *buffer, int count, struct cfs_expr_list *expr_list)
-{
-	struct cfs_range_expr *expr;
-	int i = 0, j = 0;
-	int numexprs = 0;
-
-	if (count <= 0)
-		return 0;
-
-	list_for_each_entry(expr, &expr_list->el_exprs, re_link)
-		numexprs++;
-
-	if (numexprs > 1)
-		i += scnprintf(buffer + i, count - i, "[");
-
-	list_for_each_entry(expr, &expr_list->el_exprs, re_link) {
-		if (j++)
-			i += scnprintf(buffer + i, count - i, ",");
-		i += cfs_range_expr_print(buffer + i, count - i, expr,
-					  numexprs > 1);
-	}
-
-	if (numexprs > 1)
-		i += scnprintf(buffer + i, count - i, "]");
-
-	return i;
-}
-EXPORT_SYMBOL(cfs_expr_list_print);
-
 /**
  * Matches value (@value) against ranges expression list @expr_list.
  *
diff --git a/net/lnet/lnet/nidstrings.c b/net/lnet/lnet/nidstrings.c
index 05a9b3275624..893eaa4c48ef 100644
--- a/net/lnet/lnet/nidstrings.c
+++ b/net/lnet/lnet/nidstrings.c
@@ -591,6 +591,74 @@ cfs_ip_addr_parse(char *str, int len, struct list_head *list)
 	return rc;
 }
 
+/**
+ * Print the range expression @expr into specified @buffer.
+ * If @bracketed is true, expression does not need additional
+ * brackets.
+ *
+ * Return	number of characters written
+ */
+static int
+cfs_range_expr_print(char *buffer, int count, struct cfs_range_expr *expr,
+		     bool bracketed)
+{
+	int i;
+	char s[] = "[";
+	char e[] = "]";
+
+	if (bracketed) {
+		s[0] = '\0';
+		e[0] = '\0';
+	}
+
+	if (expr->re_lo == expr->re_hi)
+		i = scnprintf(buffer, count, "%u", expr->re_lo);
+	else if (expr->re_stride == 1)
+		i = scnprintf(buffer, count, "%s%u-%u%s",
+			      s, expr->re_lo, expr->re_hi, e);
+	else
+		i = scnprintf(buffer, count, "%s%u-%u/%u%s",
+			      s, expr->re_lo, expr->re_hi,
+			      expr->re_stride, e);
+	return i;
+}
+
+/**
+ * Print a list of range expressions (\a expr_list) into specified \a buffer.
+ * If the list contains several expressions, separate them with comma
+ * and surround the list with brackets.
+ *
+ * Return	number of characters written
+ */
+static int
+cfs_expr_list_print(char *buffer, int count, struct cfs_expr_list *expr_list)
+{
+	struct cfs_range_expr *expr;
+	int i = 0, j = 0;
+	int numexprs = 0;
+
+	if (count <= 0)
+		return 0;
+
+	list_for_each_entry(expr, &expr_list->el_exprs, re_link)
+		numexprs++;
+
+	if (numexprs > 1)
+		i += scnprintf(buffer + i, count - i, "[");
+
+	list_for_each_entry(expr, &expr_list->el_exprs, re_link) {
+		if (j++ != 0)
+			i += scnprintf(buffer + i, count - i, ",");
+		i += cfs_range_expr_print(buffer + i, count - i, expr,
+					  numexprs > 1);
+	}
+
+	if (numexprs > 1)
+		i += scnprintf(buffer + i, count - i, "]");
+
+	return i;
+}
+
 static int
 libcfs_ip_addr_range_print(char *buffer, int count, struct list_head *list)
 {
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 31/33] lnet: libcfs: Remove reference to LASSERT_ATOMIC_POS
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (29 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 30/33] lnet: libcfs: move cfs_expr_list_print to nidstrings.c James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 32/33] lnet: ksocklnd: ksocklnd_ni_get_eth_intf_speed() must use only rtnl lock James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 33/33] lustre: ldlm: convert ldlm extent locks to linux extent-tree James Simmons
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Arshad Hussain, Lustre Development List

From: Arshad Hussain <arshad.hussain@aeoncomputing.com>

This patch removes all reference to LASSERT_ATOMIC_POS macro.
Once all the access is removed it would be easier to just
toggle atomic_* API calls with recount_* counts.

WC-bug-id: https://jira.whamcloud.com/browse/LU-16796
Lustre-commit: 165433bb4ced42560 ("LU-16796 libcfs: Remove reference to LASSERT_ATOMIC_POS")
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50881
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/include/obd_class.h         |  4 ++--
 fs/lustre/ptlrpc/sec.c                | 16 ++++++++--------
 include/linux/libcfs/libcfs_private.h |  1 -
 net/lnet/klnds/o2iblnd/o2iblnd.h      |  2 +-
 4 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/fs/lustre/include/obd_class.h b/fs/lustre/include/obd_class.h
index 06dfcf9bbd9e..f8ae45b6e986 100644
--- a/fs/lustre/include/obd_class.h
+++ b/fs/lustre/include/obd_class.h
@@ -270,7 +270,7 @@ static inline void class_export_rpc_inc(struct obd_export *exp)
 
 static inline void class_export_rpc_dec(struct obd_export *exp)
 {
-	LASSERT_ATOMIC_POS(&exp->exp_rpc_count);
+	LASSERT(atomic_read(&(exp)->exp_rpc_count) > 0);
 	atomic_dec(&(exp)->exp_rpc_count);
 	CDEBUG(D_INFO, "RPC PUTting export %p : new rpc_count %d\n",
 	       (exp), atomic_read(&(exp)->exp_rpc_count));
@@ -289,7 +289,7 @@ static inline struct obd_export *class_export_lock_get(struct obd_export *exp,
 static inline void class_export_lock_put(struct obd_export *exp,
 					 struct ldlm_lock *lock)
 {
-	LASSERT_ATOMIC_POS(&exp->exp_locks_count);
+	LASSERT(atomic_read(&(exp)->exp_rpc_count) > 0);
 	atomic_dec(&(exp)->exp_locks_count);
 	__class_export_del_lock_ref(exp, lock);
 	CDEBUG(D_INFO, "lock PUTting export %p : new locks_count %d\n",
diff --git a/fs/lustre/ptlrpc/sec.c b/fs/lustre/ptlrpc/sec.c
index 7cd09ebe78db..576e6480cda8 100644
--- a/fs/lustre/ptlrpc/sec.c
+++ b/fs/lustre/ptlrpc/sec.c
@@ -290,7 +290,7 @@ void sptlrpc_cli_ctx_put(struct ptlrpc_cli_ctx *ctx, int sync)
 	struct ptlrpc_sec *sec = ctx->cc_sec;
 
 	LASSERT(sec);
-	LASSERT_ATOMIC_POS(&ctx->cc_refcount);
+	LASSERT(atomic_read(&(ctx)->cc_refcount) > 0);
 
 	if (!atomic_dec_and_test(&ctx->cc_refcount))
 		return;
@@ -1214,7 +1214,7 @@ static void sec_cop_destroy_sec(struct ptlrpc_sec *sec)
 
 static void sptlrpc_sec_kill(struct ptlrpc_sec *sec)
 {
-	LASSERT_ATOMIC_POS(&sec->ps_refcount);
+	LASSERT(atomic_read(&(sec)->ps_refcount) > 0);
 
 	if (sec->ps_policy->sp_cops->kill_sec) {
 		sec->ps_policy->sp_cops->kill_sec(sec);
@@ -1234,7 +1234,7 @@ static struct ptlrpc_sec *sptlrpc_sec_get(struct ptlrpc_sec *sec)
 void sptlrpc_sec_put(struct ptlrpc_sec *sec)
 {
 	if (sec) {
-		LASSERT_ATOMIC_POS(&sec->ps_refcount);
+		LASSERT(atomic_read(&(sec)->ps_refcount) > 0);
 
 		if (atomic_dec_and_test(&sec->ps_refcount)) {
 			sptlrpc_gc_del_sec(sec);
@@ -1314,7 +1314,7 @@ static void sptlrpc_import_sec_install(struct obd_import *imp,
 {
 	struct ptlrpc_sec *old_sec;
 
-	LASSERT_ATOMIC_POS(&sec->ps_refcount);
+	LASSERT(atomic_read(&(sec)->ps_refcount) > 0);
 
 	write_lock(&imp->imp_sec_lock);
 	old_sec = imp->imp_sec;
@@ -1507,7 +1507,7 @@ int sptlrpc_cli_alloc_reqbuf(struct ptlrpc_request *req, int msgsize)
 	LASSERT(ctx->cc_sec);
 	LASSERT(ctx->cc_sec->ps_policy);
 	LASSERT(!req->rq_reqmsg);
-	LASSERT_ATOMIC_POS(&ctx->cc_refcount);
+	LASSERT(atomic_read(&(ctx)->cc_refcount) > 0);
 
 	policy = ctx->cc_sec->ps_policy;
 	rc = policy->sp_cops->alloc_reqbuf(ctx->cc_sec, req, msgsize);
@@ -1535,7 +1535,7 @@ void sptlrpc_cli_free_reqbuf(struct ptlrpc_request *req)
 	LASSERT(ctx);
 	LASSERT(ctx->cc_sec);
 	LASSERT(ctx->cc_sec->ps_policy);
-	LASSERT_ATOMIC_POS(&ctx->cc_refcount);
+	LASSERT(atomic_read(&(ctx)->cc_refcount) > 0);
 
 	if (!req->rq_reqbuf && !req->rq_clrbuf)
 		return;
@@ -1655,7 +1655,7 @@ void sptlrpc_cli_free_repbuf(struct ptlrpc_request *req)
 	LASSERT(ctx);
 	LASSERT(ctx->cc_sec);
 	LASSERT(ctx->cc_sec->ps_policy);
-	LASSERT_ATOMIC_POS(&ctx->cc_refcount);
+	LASSERT(atomic_read(&(ctx)->cc_refcount) > 0);
 
 	if (!req->rq_repbuf)
 		return;
@@ -2239,7 +2239,7 @@ void sptlrpc_svc_ctx_decref(struct ptlrpc_request *req)
 	if (!ctx)
 		return;
 
-	LASSERT_ATOMIC_POS(&ctx->sc_refcount);
+	LASSERT(atomic_read(&(ctx)->sc_refcount) > 0);
 	if (atomic_dec_and_test(&ctx->sc_refcount)) {
 		if (ctx->sc_policy->sp_sops->free_ctx)
 			ctx->sc_policy->sp_sops->free_ctx(ctx);
diff --git a/include/linux/libcfs/libcfs_private.h b/include/linux/libcfs/libcfs_private.h
index 7c0fb5a1c652..cc9115a89f43 100644
--- a/include/linux/libcfs/libcfs_private.h
+++ b/include/linux/libcfs/libcfs_private.h
@@ -132,7 +132,6 @@ do {								\
 #endif /* LASSERT_ATOMIC_ENABLED */
 
 #define LASSERT_ATOMIC_ZERO(a)		LASSERT_ATOMIC_EQ(a, 0)
-#define LASSERT_ATOMIC_POS(a)		LASSERT_ATOMIC_GT(a, 0)
 
 /* implication */
 #define ergo(a, b) (!(a) || (b))
diff --git a/net/lnet/klnds/o2iblnd/o2iblnd.h b/net/lnet/klnds/o2iblnd/o2iblnd.h
index 5884cda7a707..4f83bce9e797 100644
--- a/net/lnet/klnds/o2iblnd/o2iblnd.h
+++ b/net/lnet/klnds/o2iblnd/o2iblnd.h
@@ -614,7 +614,7 @@ static inline void kiblnd_conn_decref(struct kib_conn *conn)
 	CDEBUG(D_NET, "conn[%p] (%d)--\n",
 	       conn, atomic_read(&conn->ibc_refcount));
 #endif
-	LASSERT_ATOMIC_POS(&conn->ibc_refcount);
+	LASSERT(atomic_read(&(conn)->ibc_refcount) > 0);
 	if (atomic_dec_and_test(&conn->ibc_refcount)) {
 		spin_lock_irqsave(&kiblnd_data.kib_connd_lock, flags);
 		list_add_tail(&conn->ibc_list,
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 32/33] lnet: ksocklnd: ksocklnd_ni_get_eth_intf_speed() must use only rtnl lock
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (30 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 31/33] lnet: libcfs: Remove reference to LASSERT_ATOMIC_POS James Simmons
@ 2025-02-02 20:46 ` James Simmons
  2025-02-02 20:46 ` [lustre-devel] [PATCH 33/33] lustre: ldlm: convert ldlm extent locks to linux extent-tree James Simmons
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Chris Horn, Lustre Development List

A kernel with debug enable is reporting the following:

include/linux/inetdevice.h:221 suspicious rcu_dereference_check() usage!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
5 locks held by lctl/42289:
 #0: ffffffffa04263f8 ((libcfs_ioctl_list).rwsem){++++}-{3:3}, at: __blocking_notifier_call_chain+0x44/0xa0
 #1: ffffffffa04fa7b0 (lnet_config_mutex){+.+.}-{3:3}, at: lnet_configure+0x1d/0xc0 [lnet]
 #2: ffffffffa04f06e8 (the_lnet.ln_api_mutex){+.+.}-{3:3}, at: LNetNIInit+0x4c/0x960 [lnet]
 #3: ffffffffa04f0788 (&the_lnet.ln_lnd_mutex){+.+.}-{3:3}, at: lnet_startup_lndnet+0x11e/0xa90 [lnet]
 #4: ffffffff834a0cd0 (rtnl_mutex){+.+.}-{3:3}, at: rtnl_lock+0x1b/0x30

stack backtrace:
CPU: 2 PID: 42289 Comm: lctl Kdump: loaded Tainted: G        W  O     --------- -  - 4.18.0rh8.5-debug #2
Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
  Call Trace:
  ? dump_stack+0x119/0x18e
  ? lockdep_rcu_suspicious+0x141/0x14f
  ? ksocklnd_ni_get_eth_intf_speed.isra.1+0x308/0x360 [ksocklnd]
  ? mark_held_locks+0x6a/0xc0
  ? ktime_get_with_offset+0x233/0x2b0
  ? trace_hardirqs_on+0x4e/0x220
  ? ksocknal_tunables_setup+0xed/0x200 [ksocklnd]
  ? ksocknal_startup+0x4ff/0x1180 [ksocklnd]

The function __ethtool_get_link_ksettings() has a hard requirement
to have the in_dev device protected by the rtnl mutex. At the
same time we are aquiring in_dev using the rcu lock. The in_dev
needs to be stabilized by the same lock. So use rtnl functions
instead.

WC-bug-id: https://jira.whamcloud.com/browse/LU-16807
Lustre-commit: 65d664bff40590366 ("LU-16807 ksocklnd: ksocklnd_ni_get_eth_intf_speed() must use only rtnl lock")
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51028
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Neil Brown <neilb@suse.de>
---
 net/lnet/klnds/socklnd/socklnd_modparams.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/lnet/klnds/socklnd/socklnd_modparams.c b/net/lnet/klnds/socklnd/socklnd_modparams.c
index 5eb58ca97c06..031fe13d2a38 100644
--- a/net/lnet/klnds/socklnd/socklnd_modparams.c
+++ b/net/lnet/klnds/socklnd/socklnd_modparams.c
@@ -183,11 +183,11 @@ static int ksocklnd_ni_get_eth_intf_speed(struct lnet_ni *ni)
 		if (!(flags & IFF_UP))
 			continue;
 
-		in_dev = __in_dev_get_rcu(dev);
+		in_dev = __in_dev_get_rtnl(dev);
 		if (!in_dev)
 			continue;
 
-		in_dev_for_each_ifa_rcu(ifa, in_dev) {
+		in_dev_for_each_ifa_rtnl(ifa, in_dev) {
 			if (strcmp(ifa->ifa_label, ni->ni_interface) == 0)
 				intf_idx = dev->ifindex;
 		}
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [lustre-devel] [PATCH 33/33] lustre: ldlm: convert ldlm extent locks to linux extent-tree
  2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
                   ` (31 preceding siblings ...)
  2025-02-02 20:46 ` [lustre-devel] [PATCH 32/33] lnet: ksocklnd: ksocklnd_ni_get_eth_intf_speed() must use only rtnl lock James Simmons
@ 2025-02-02 20:46 ` James Simmons
  32 siblings, 0 replies; 34+ messages in thread
From: James Simmons @ 2025-02-02 20:46 UTC (permalink / raw)
  To: Andreas Dilger, Oleg Drokin, NeilBrown
  Cc: Yang Sheng, Lustre Development List

From: Mr NeilBrown <neilb@suse.de>

The original work for coverting ldlm_extent locks to the
standard linux extent tree has some bugs which could lead
to kernel crashes such as:

LustreError: 10543:0:(osc_cache.c:1141:osc_extent_make_ready()) ASSERTION( last_oap_count > 0 ) failed: last_oap_count 0
LustreError: 10543:0:(osc_cache.c:1141:osc_extent_make_ready()) LBUG
Pid: 10543, comm: ldlm_bl_05 3.10.0-7.9-debug #1 SMP Mon Feb 1 17:33:41 EST 2021
Call Trace:
[<0>] libcfs_call_trace+0x90/0xf0 [libcfs]
[<0>] lbug_with_loc+0x4c/0xa0 [libcfs]
[<0>] osc_extent_make_ready+0xb66/0xe60 [osc]
[<0>] osc_cache_writeback_range+0x4d3/0xfd0 [osc]
[<0>] osc_lock_flush+0x195/0x290 [osc]
[<0>] osc_ldlm_blocking_ast+0x2f8/0x3e0 [osc]
[<0>] ldlm_cancel_callback+0x84/0x320 [ptlrpc]
[<0>] ldlm_cli_cancel_local+0xd1/0x420 [ptlrpc]
[<0>] ldlm_cli_cancel+0x10c/0x560 [ptlrpc]
[<0>] osc_ldlm_blocking_ast+0x17a/0x3e0 [osc]
[<0>] ldlm_handle_bl_callback+0xc5/0x3e0 [ptlrpc]
[<0>] ldlm_bl_thread_main+0x5bf/0xae0 [ptlrpc]
[<0>] kthread+0xe4/0xf0

This work fixes up the kms handling code and brings us into sync
with later work on the interval tree cleanup done.

Fixes: d5aaf4d1355 ("lustre: convert ldlm extent locks to linux extent-tree")
WC-bug-id: https://jira.whamcloud.com/browse/LU-11085
Lustre-commit: d2ff746a997395e6a ("LU-11085 ldlm: convert ldlm extent locks to linux extent-tree")
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Signed-off-by: Yang Sheng <ys@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/41792
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/include/lustre_dlm.h | 22 ++++++++++-----
 fs/lustre/ldlm/ldlm_extent.c   | 47 ++++++++++++++++++++++----------
 fs/lustre/ldlm/ldlm_lock.c     | 49 ++++++++++++++++------------------
 fs/lustre/ldlm/ldlm_lockd.c    |  5 ++--
 4 files changed, 75 insertions(+), 48 deletions(-)

diff --git a/fs/lustre/include/lustre_dlm.h b/fs/lustre/include/lustre_dlm.h
index a3a339f82d1a..4217a8ad4501 100644
--- a/fs/lustre/include/lustre_dlm.h
+++ b/fs/lustre/include/lustre_dlm.h
@@ -48,6 +48,7 @@
 #include <lustre_net.h>
 #include <lustre_import.h>
 #include <lustre_handles.h>
+#include <linux/interval_tree_generic.h>
 #include <lu_ref.h>
 
 #include "lustre_dlm_flags.h"
@@ -574,7 +575,7 @@ struct ldlm_glimpse_work {
  * Interval tree for extent locks.
  * The interval tree must be accessed under the resource lock.
  * Interval trees are used for granted extent locks to speed up conflicts
- * lookup. See ldlm/interval_tree.c for more details.
+ * lookup.
  */
 struct ldlm_interval_tree {
 	/** Tree size. */
@@ -666,11 +667,14 @@ struct ldlm_lock {
 	 * Protected by lr_lock in struct ldlm_resource.
 	 */
 	struct list_head		l_res_link;
+
 	/**
-	 * Interval-tree node for ldlm_extent.
+	 * Internal structure per lock type..
 	 */
+	/* LDLM_EXTENT locks only */
+	struct ldlm_extent		l_req_extent;
 	struct rb_node			l_rb;
-	u64				__subtree_last;
+	u64				l_subtree_last;
 
 	/**
 	 * Requested mode.
@@ -750,9 +754,6 @@ struct ldlm_lock {
 	 */
 	ktime_t				l_last_used;
 
-	/** Originally requested extent for the extent lock. */
-	struct ldlm_extent		l_req_extent;
-
 	/*
 	 * Client-side-only members.
 	 */
@@ -858,6 +859,15 @@ enum ldlm_match_flags {
 	LDLM_MATCH_GROUP	= BIT(4),
 };
 
+#define extent_last(tree) rb_entry_safe(rb_last(&tree->lit_root.rb_root),\
+					struct ldlm_lock, l_rb)
+#define extent_first(tree) rb_entry_safe(rb_first(&tree->lit_root.rb_root),\
+					 struct ldlm_lock, l_rb)
+#define extent_top(tree) rb_entry_safe(tree->lit_root.rb_root.rb_node, \
+				       struct ldlm_lock, l_rb)
+#define extent_prev(lock) rb_entry_safe(rb_prev(&lock->l_rb),		\
+					struct ldlm_lock, l_rb)
+
 /**
  * Describe the overlap between two locks.  itree_overlap_cb data.
  */
diff --git a/fs/lustre/ldlm/ldlm_extent.c b/fs/lustre/ldlm/ldlm_extent.c
index 15ce512cf10c..489de60822bb 100644
--- a/fs/lustre/ldlm/ldlm_extent.c
+++ b/fs/lustre/ldlm/ldlm_extent.c
@@ -63,7 +63,7 @@
 
 #define START(node) ISTART((node)->l_policy_data.l_extent.end)
 #define LAST(node) IEND((node)->l_policy_data.l_extent.start)
-INTERVAL_TREE_DEFINE(struct ldlm_lock, l_rb, u64, __subtree_last,
+INTERVAL_TREE_DEFINE(struct ldlm_lock, l_rb, u64, l_subtree_last,
 		     START, LAST, static, extent);
 
 /* When a lock is cancelled by a client, the KMS may undergo change if this
@@ -81,7 +81,7 @@ u64 ldlm_extent_shift_kms(struct ldlm_lock *lock, u64 old_kms)
 	struct ldlm_lock *lck;
 	u64 kms = 0;
 	int idx = 0;
-	bool complete;
+	bool complete = false;
 
 	/* don't let another thread in ldlm_extent_shift_kms race in
 	 * just after we finish and take our lock into account in its
@@ -90,22 +90,27 @@ u64 ldlm_extent_shift_kms(struct ldlm_lock *lock, u64 old_kms)
 	ldlm_set_kms_ignore(lock);
 
 	/* We iterate over the lock trees, looking for the largest kms
-	 * smaller than the current one.  Note that each tree is
-	 * iterated starting a largest end, because the interval tree
-	 * is stored last-to-first order.
+	 * smaller than the current one.
 	 */
 	for (idx = 0; idx < LCK_MODE_NUM; idx++) {
 		tree = &res->lr_itree[idx];
 
-		for (lck = extent_iter_first(&tree->lit_root, 0, U64_MAX);
+		/* If our already known kms is >= than the highest 'end' in
+		 * this tree, we don't need to check this tree, because
+		 * the kms from a tree can be lower than in_max_high (due to
+		 * kms_ignore), but it can never be higher.
+		 */
+		lck = extent_top(tree);
+		if (!lck || kms >= lck->l_subtree_last)
+			continue;
+
+		for (lck = extent_last(tree);
 		     lck;
-		     lck = extent_iter_next(lck, 0, U64_MAX)) {
+		     lck = extent_prev(lck)) {
 			if (ldlm_is_kms_ignore(lck))
 				continue;
 
-			/* This is the last lock-end that doesn't ignore
-			 * kms.
-			 * If it has a greater or equal kms, we are not
+			/* If this lock has a greater or equal kms, we are not
 			 * the highest lock (or we share that distinction
 			 * with another lock), and don't need to update KMS.
 			 * Record old_kms and stop looking.
@@ -114,9 +119,21 @@ u64 ldlm_extent_shift_kms(struct ldlm_lock *lock, u64 old_kms)
 			    lck->l_policy_data.l_extent.end + 1 >= old_kms) {
 				kms = old_kms;
 				complete = true;
-			} else
+				break;
+			}
+			if (lck->l_policy_data.l_extent.end + 1 > kms)
 				kms = lck->l_policy_data.l_extent.end + 1;
-			break;
+
+			/* Since we start with the highest lock and work
+			 * down, for PW locks, we only need to check if we
+			 * should update the kms, then stop walking the tree.
+			 * PR locks are not exclusive, so the highest start
+			 * does not imply the highest end and we must
+			 * continue.  (Only one group lock is allowed per
+			 * resource, so this is irrelevant for group locks.)
+			 */
+			if (lck->l_granted_mode == LCK_PW)
+				break;
 		}
 
 		/* this tells us we're not the highest lock, so we don't need
@@ -126,8 +143,7 @@ u64 ldlm_extent_shift_kms(struct ldlm_lock *lock, u64 old_kms)
 			break;
 	}
 
-	LASSERTF(kms <= old_kms, "kms %llu old_kms %llu\n", kms,
-		 old_kms);
+	LASSERTF(kms <= old_kms, "kms %llu old_kms %llu\n", kms, old_kms);
 
 	return kms;
 }
@@ -204,8 +220,11 @@ void ldlm_extent_unlink_lock(struct ldlm_lock *lock)
 	LASSERT(lock->l_granted_mode == BIT(idx));
 	tree = &res->lr_itree[idx];
 
+	LASSERT(!RB_EMPTY_ROOT(&tree->lit_root.rb_root));
+
 	tree->lit_size--;
 	extent_remove(lock, &tree->lit_root);
+	RB_CLEAR_NODE(&lock->l_rb);
 }
 
 void ldlm_extent_policy_wire_to_local(const union ldlm_wire_policy_data *wpolicy,
diff --git a/fs/lustre/ldlm/ldlm_lock.c b/fs/lustre/ldlm/ldlm_lock.c
index 5fcae3864483..739798bd95d9 100644
--- a/fs/lustre/ldlm/ldlm_lock.c
+++ b/fs/lustre/ldlm/ldlm_lock.c
@@ -182,8 +182,6 @@ void ldlm_lock_put(struct ldlm_lock *lock)
 		lprocfs_counter_decr(ldlm_res_to_ns(res)->ns_stats,
 				     LDLM_NSS_LOCKS);
 		lu_ref_del(&res->lr_reference, "lock", lock);
-		ldlm_resource_putref(res);
-		lock->l_resource = NULL;
 		if (lock->l_export) {
 			class_export_lock_put(lock->l_export, lock);
 			lock->l_export = NULL;
@@ -191,6 +189,8 @@ void ldlm_lock_put(struct ldlm_lock *lock)
 
 		kvfree(lock->l_lvb_data);
 
+		ldlm_resource_putref(res);
+		lock->l_resource = NULL;
 		lu_ref_fini(&lock->l_reference);
 		call_rcu(&lock->l_handle.h_rcu, lock_handle_free);
 	}
@@ -399,6 +399,7 @@ static struct ldlm_lock *ldlm_lock_new(struct ldlm_resource *resource)
 	lock->l_blocking_lock = NULL;
 	INIT_LIST_HEAD(&lock->l_sl_mode);
 	INIT_LIST_HEAD(&lock->l_sl_policy);
+	/* LDLM_EXTENT */
 	RB_CLEAR_NODE(&lock->l_rb);
 
 	lprocfs_counter_incr(ldlm_res_to_ns(resource)->ns_stats,
@@ -1042,6 +1043,8 @@ void ldlm_grant_lock(struct ldlm_lock *lock, struct list_head *work_list)
  *
  * @lock	test-against this lock
  * @data	parameters
+ *
+ * RETURN	returns true if @lock matches @data, false otherwise
  */
 static bool lock_matches(struct ldlm_lock *lock, void *vdata)
 {
@@ -1052,15 +1055,13 @@ static bool lock_matches(struct ldlm_lock *lock, void *vdata)
 	if (lock == data->lmd_old)
 		return true;
 
-	/*
-	 * Check if this lock can be matched.
+	/* Check if this lock can be matched.
 	 * Used by LU-2919(exclusive open) for open lease lock
 	 */
 	if (ldlm_is_excl(lock))
 		return false;
 
-	/*
-	 * llite sometimes wants to match locks that will be
+	/* llite sometimes wants to match locks that will be
 	 * canceled when their users drop, but we allow it to match
 	 * if it passes in CBPENDING and the lock still has users.
 	 * this is generally only going to be used by children
@@ -1106,10 +1107,7 @@ static bool lock_matches(struct ldlm_lock *lock, void *vdata)
 			return false;
 		break;
 	case LDLM_IBITS:
-		/*
-		 * We match if we have existing lock with same or wider set
-		 * of bits.
-		 */
+		/* We match with existing lock with same or wider set of bits. */
 		if ((lpol->l_inodebits.bits &
 		     data->lmd_policy->l_inodebits.bits) !=
 		    data->lmd_policy->l_inodebits.bits)
@@ -1124,10 +1122,8 @@ static bool lock_matches(struct ldlm_lock *lock, void *vdata)
 	default:
 		break;
 	}
-	/*
-	 * We match if we have existing lock with same or wider set
-	 * of bits.
-	 */
+
+	/* We match if we have existing lock with same or wider set of bits. */
 	if (!(data->lmd_match & LDLM_MATCH_UNREF) && LDLM_HAVE_MASK(lock, GONE))
 		return false;
 
@@ -1168,16 +1164,13 @@ static bool lock_matches(struct ldlm_lock *lock, void *vdata)
 struct ldlm_lock *search_itree(struct ldlm_resource *res,
 			       struct ldlm_match_data *data)
 {
-	struct ldlm_extent ext = {
-		.start	= data->lmd_policy->l_extent.start,
-		.end	= data->lmd_policy->l_extent.end
-	};
+	u64 end = data->lmd_policy->l_extent.end;
 	int idx;
 
 	data->lmd_lock = NULL;
 
 	if (data->lmd_match & LDLM_MATCH_RIGHT)
-		ext.end = OBD_OBJECT_EOF;
+		end = OBD_OBJECT_EOF;
 
 	for (idx = 0; idx < LCK_MODE_NUM; idx++) {
 		struct ldlm_interval_tree *tree = &res->lr_itree[idx];
@@ -1188,7 +1181,9 @@ struct ldlm_lock *search_itree(struct ldlm_resource *res,
 		if (!(tree->lit_mode & *data->lmd_mode))
 			continue;
 
-		ldlm_extent_search(&tree->lit_root, ext.start, ext.end,
+		ldlm_extent_search(&tree->lit_root,
+				   data->lmd_policy->l_extent.start,
+				   end,
 				   lock_matches, data);
 		if (data->lmd_lock)
 			return data->lmd_lock;
@@ -1557,7 +1552,7 @@ struct ldlm_lock *ldlm_lock_create(struct ldlm_namespace *ns,
 {
 	struct ldlm_lock *lock;
 	struct ldlm_resource *res;
-	int rc;
+	int rc = 0;
 
 	res = ldlm_resource_get(ns, res_id, type, 1);
 	if (IS_ERR(res))
@@ -1603,11 +1598,13 @@ struct ldlm_lock *ldlm_lock_create(struct ldlm_namespace *ns,
 
 /**
  * Enqueue (request) a lock.
- * On the client this is called from ldlm_cli_enqueue_fini
- * after we already got an initial reply from the server with some status.
  *
  * Does not block. As a result of enqueue the lock would be put
  * into granted or waiting list.
+ *
+ * If namespace has intent policy sent and the lock has LDLM_FL_HAS_INTENT flag
+ * set, skip all the enqueueing and delegate lock processing to intent policy
+ * function.
  */
 enum ldlm_error ldlm_lock_enqueue(const struct lu_env *env,
 				  struct ldlm_namespace *ns,
@@ -1616,6 +1613,7 @@ enum ldlm_error ldlm_lock_enqueue(const struct lu_env *env,
 {
 	struct ldlm_lock *lock = *lockp;
 	struct ldlm_resource *res;
+	enum ldlm_error rc = ELDLM_OK;
 
 	res = lock_res_and_lock(lock);
 	if (ldlm_is_granted(lock)) {
@@ -1637,8 +1635,7 @@ enum ldlm_error ldlm_lock_enqueue(const struct lu_env *env,
 	if (*flags & LDLM_FL_TEST_LOCK)
 		ldlm_set_test_lock(lock);
 
-	/*
-	 * This distinction between local lock trees is very important; a client
+	/* This distinction between local lock trees is very important; a client
 	 * namespace only has information about locks taken by that client, and
 	 * thus doesn't have enough information to decide for itself if it can
 	 * be granted (below).  In this case, we do exactly what the server
@@ -1651,7 +1648,7 @@ enum ldlm_error ldlm_lock_enqueue(const struct lu_env *env,
 
 out:
 	unlock_res_and_lock(lock);
-	return ELDLM_OK;
+	return rc;
 }
 
 /**
diff --git a/fs/lustre/ldlm/ldlm_lockd.c b/fs/lustre/ldlm/ldlm_lockd.c
index a839ff2177d1..46ab61e78231 100644
--- a/fs/lustre/ldlm/ldlm_lockd.c
+++ b/fs/lustre/ldlm/ldlm_lockd.c
@@ -1283,17 +1283,18 @@ int ldlm_init(void)
 						    0, SLAB_HWCACHE_ALIGN,
 						    NULL);
 	if (!ldlm_interval_tree_slab)
-		goto out_lock;
+		goto out_lock_slab;
 
 #if LUSTRE_TRACKS_LOCK_EXP_REFS
 	class_export_dump_hook = ldlm_dump_export_locks;
 #endif
 	return 0;
 
-out_lock:
+out_lock_slab:
 	kmem_cache_destroy(ldlm_lock_slab);
 out_resource:
 	kmem_cache_destroy(ldlm_resource_slab);
+
 	return -ENOMEM;
 }
 
-- 
2.39.3

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

^ permalink raw reply related	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2025-02-02 21:14 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-02 20:46 [lustre-devel] [PATCH 00/33] lustre: sync to OpenSFS branch May 31, 2023 James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 01/33] lnet: set msg field for lnet message header James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 02/33] Revert "lustre: llite: Check vmpage in releasepage" James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 03/33] lustre: llite: EIO is possible on a race with page reclaim James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 04/33] lustre: llite: add __GFP_NORETRY for read-ahead page James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 05/33] lustre: obd: change lmd flags to bitmap James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 06/33] lustre: uapi: cleanup FSFILT defines James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 07/33] lustre: obd: Reserve metadata overstriping flags James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 08/33] lnet: selftest: manage the workqueue state properly James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 09/33] lustre: remove cl_{offset, index, page_size} helpers James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 10/33] lustre: csdc: reserve layout bits for compress component James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 11/33] lustre: obd: replace simple_strtoul() James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 12/33] lnet: Use dynamic allocation for LND tunables James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 13/33] lustre: cksum: fix generating T10PI guard tags for partial brw page James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 14/33] lustre: llite: remove OBD_ -> CFS_ macros James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 15/33] lustre: obd: " James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 16/33] lnet: improve numeric NID to CPT hashing James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 17/33] lnet: libcfs: Remove unsed LASSERT_ATOMIC_* macros James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 18/33] lustre: misc: replace obsolete ioctl numbers James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 19/33] lustre: lmv: treat unknown hash type as sane type James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 20/33] lustre: llite: Fix return for non-queued aio James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 21/33] lnet: collect data about routes by using Netlink James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 22/33] lustre: ptlrpc: switch sptlrpc_rule_set_choose to large nid James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 23/33] lnet: use list_first_entry() where appropriate James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 24/33] lustre: statahead: using try lock for batched RPCs James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 25/33] lnet: libcfs: use round_up directly James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 26/33] lustre: mdc: md_open_data should keep ref on close_req James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 27/33] lustre: llite: update comment of ll_swap_layouts_close James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 28/33] lustre: ldlm: replace OBD_ -> CFS_ macros James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 29/33] lustre: mdc: remove " James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 30/33] lnet: libcfs: move cfs_expr_list_print to nidstrings.c James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 31/33] lnet: libcfs: Remove reference to LASSERT_ATOMIC_POS James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 32/33] lnet: ksocklnd: ksocklnd_ni_get_eth_intf_speed() must use only rtnl lock James Simmons
2025-02-02 20:46 ` [lustre-devel] [PATCH 33/33] lustre: ldlm: convert ldlm extent locks to linux extent-tree James Simmons

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).