Skip to contentSkip to conversation

lustre: Update to OpenSFS as of Aug 3 2022

PATCH New James Simmons 1 participant 33 messages Aug 4, 2022 Networking

lore
Share & tools
lore
#0 lore raw

cover lustre: Update to OpenSFS as of Aug 3 2022

Sync to latest OpenSFS tree except for crush2 support which exposed several hidden bugs. Will need to resolve the issue. Also need to see how Lustre's handling of fscrypt not fully implemented for 2.14.

Alexey Lyashkov (1):
lnet: Replace msg_rdma_force with a new md_flag LNET_MD_FLAG_GPU.

Andreas Dilger (1):
lustre: llite: add projid to debug logs

Chris Horn (4):
lnet: socklnd: Duplicate ksock_conn_cb
lnet: Ensure round robin across nets
lnet: Define KFILND network type
lnet: Adjust niov checks for large MD

Cyril Bordage (1):
lnet: o2iblnd: add debug messages for IB

Etienne AUJAMES (1):
lustre: llog: Add LLOG_SKIP_PLAIN to skip llog plain

Gian-Carlo DeFazio (1):
lnet: asym route inconsistency warning

Hongchao Zhang (1):
lustre: quota: skip non-exist or inact tgt for lfs_quota

James Simmons (1):
lustre: ec: code to add support for M to N parity

John L. Hammond (4):
lustre: echo: remove client operations from echo objects
lustre: clio: remove cl_page_export() and cl_page_is_vmlocked()
lustre: clio: remove cpo_own and cpo_disown
lustre: clio: remove cpo_assume, cpo_unassume, cpo_fini

Lai Siyao (5):
lustre: llite: enforce ROOT default on subdir mount
lustre: lmv: support striped LMVs
lustre: mdc: pack default LMV in open reply
lustre: llite: use max default EA size to get default LMV
lustre: llite: pass dmv inherit depth instead of dir depth

Mikhail Pershin (1):
lustre: client: able to cleanup devices manually

Mr NeilBrown (3):
lnet: discard some peer_ni lookup functions
lnet: change lnet_*_peer_ni to take struct lnet_nid
lnet: libcfs: debugfs file_operation should have an owner

Oleg Drokin (1):
lustre: mdc: Remove entry from list before freeing

Patrick Farrell (2):
lustre: flr: Don't assume RDONLY implies SOM
lustre: ldlm: Prioritize blocking callbacks

Qian Yingjin (2):
lustre: som: disabling xattr cache for LSOM on client
lustre: llite: dont restart directIO with IOCB_NOWAIT

Sebastien Buisson (2):
lustre: enc: enc-unaware clients get ENOKEY if file not found
lustre: sec: handle read-only flag

Serguei Smirnov (1):
lnet: o2iblnd: debug message is missing a newline

 fs/lustre/Makefile                      |   2 +-
 fs/lustre/ec/Makefile                   |   4 +
 fs/lustre/ec/ec_base.c                  | 352 +++++++++++++++++++++
 fs/lustre/include/cl_object.h           |  84 +----
 fs/lustre/include/erasure_code.h        | 142 +++++++++
 fs/lustre/include/lustre_lmv.h          |  29 +-
 fs/lustre/include/lustre_log.h          |  18 +-
 fs/lustre/include/lustre_net.h          |   4 +-
 fs/lustre/include/obd_support.h         |   8 +-
 fs/lustre/ldlm/ldlm_lockd.c             |  39 ++-
 fs/lustre/llite/crypto.c                |  35 ++-
 fs/lustre/llite/dir.c                   |  98 +++---
 fs/lustre/llite/file.c                  |  10 +-
 fs/lustre/llite/llite_internal.h        |   7 +
 fs/lustre/llite/llite_lib.c             | 101 +++++-
 fs/lustre/llite/namei.c                 |   4 +-
 fs/lustre/llite/rw.c                    |  53 ++--
 fs/lustre/llite/rw26.c                  |   6 +-
 fs/lustre/llite/vvp_dev.c               |   3 +-
 fs/lustre/llite/vvp_internal.h          |   3 -
 fs/lustre/llite/vvp_page.c              | 188 +----------
 fs/lustre/llite/xattr.c                 |   3 +-
 fs/lustre/llite/xattr_cache.c           |   4 +
 fs/lustre/lmv/lmv_obd.c                 |  29 +-
 fs/lustre/lov/lov_io.c                  |   7 -
 fs/lustre/lov/lov_obd.c                 |  21 +-
 fs/lustre/lov/lov_page.c                |   2 +-
 fs/lustre/mdc/mdc_changelog.c           |   8 +-
 fs/lustre/mdc/mdc_lib.c                 |   1 +
 fs/lustre/mdc/mdc_locks.c               |   2 +
 fs/lustre/mdc/mdc_request.c             |   7 +-
 fs/lustre/obdclass/cl_io.c              |  15 +-
 fs/lustre/obdclass/cl_page.c            | 264 ++++++++--------
 fs/lustre/obdecho/echo_client.c         | 542 +-------------------------------
 fs/lustre/osc/osc_lock.c                |   2 +-
 fs/lustre/osc/osc_request.c             |   3 +
 fs/lustre/ptlrpc/import.c               |   4 +-
 fs/lustre/ptlrpc/layout.c               |   1 +
 fs/lustre/ptlrpc/niobuf.c               |   3 +-
 fs/lustre/ptlrpc/pers.c                 |   3 +
 fs/lustre/ptlrpc/wiretest.c             |   2 +
 include/linux/libcfs/libcfs.h           |   4 +-
 include/linux/lnet/lib-lnet.h           |  12 +-
 include/linux/lnet/lib-types.h          |  14 +-
 include/uapi/linux/lnet/lnet-types.h    |   2 +
 include/uapi/linux/lnet/nidstr.h        |   1 +
 include/uapi/linux/lustre/lustre_user.h |   5 +-
 net/lnet/klnds/o2iblnd/o2iblnd.c        |   2 +-
 net/lnet/klnds/o2iblnd/o2iblnd.h        |  23 +-
 net/lnet/klnds/o2iblnd/o2iblnd_cb.c     |  50 ++-
 net/lnet/klnds/socklnd/socklnd.c        |  19 +-
 net/lnet/klnds/socklnd/socklnd_cb.c     |   5 +-
 net/lnet/libcfs/module.c                |  43 ++-
 net/lnet/lnet/api-ni.c                  |  40 ++-
 net/lnet/lnet/lib-md.c                  |   3 +
 net/lnet/lnet/lib-move.c                | 114 ++++---
 net/lnet/lnet/module.c                  |   1 +
 net/lnet/lnet/nidstrings.c              |  10 +
 net/lnet/lnet/peer.c                    | 237 ++++++--------
 net/lnet/lnet/router.c                  |  21 +-
 net/lnet/lnet/router_proc.c             |  10 +-
 net/lnet/lnet/udsp.c                    |   8 +-
 62 files changed, 1399 insertions(+), 1338 deletions(-)
 create mode 100644 fs/lustre/ec/Makefile
 create mode 100644 fs/lustre/ec/ec_base.c
 create mode 100644 fs/lustre/include/erasure_code.h
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#1 lore raw

PATCH 1/32 lustre: mdc: Remove entry from list before freeing

From: Oleg Drokin <[email protected]>

mdc_changelog_cdev_init forgot to remove entries from list if chardev allocation failed

Fixes dcedf3009a71 ("lustre: changelog: support large number of MDT")

WC-bug-id: https://jira.whamcloud.com/browse/LU-15901
Lustre-commit: 441ec2296a0938dd3 ("LU-15901 mdc: Remove entry from list before freeing")

Reviewed-on: https://review.whamcloud.com/47480

---
 fs/lustre/mdc/mdc_changelog.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/lustre/mdc/mdc_changelog.c +2 -1
index d366720..36d7fdd 100644
@@ -837,7 +837,7 @@ int mdc_changelog_cdev_init(struct obd_device *obd)
 
 	rc = chlg_minor_alloc(&minor);
 	if (rc)
-		goto out_unlock;
+		goto out_listrm;
 
 	device_initialize(&entry->ced_device);
 	entry->ced_device.devt = MKDEV(MAJOR(mdc_changelog_dev), minor);
@@ -866,6 +866,7 @@ int mdc_changelog_cdev_init(struct obd_device *obd)
 out_minor:
 	chlg_minor_free(minor);
 
+out_listrm:
 	list_del_init(&obd->u.cli.cl_chg_dev_linkage);
 	list_del(&entry->ced_link);
 
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#2 lore raw

PATCH 2/32 lustre: flr: Don't assume RDONLY implies SOM

In reply to James Simmons

From: Patrick Farrell <[email protected]>

In lov_io_slice_mirror_init, the client code assumes that the LCM_FL_RDONLY flag in the layout implies SOM and skips glimpse if it sees one. The RDONLY flag means the mirrors are in sync, which has historically implied SOM is valid.

To start with, using LCM_FL_RDONLY to imply SOM is sort of a layering violation. SOM is only communicated from the MDS when it is valid, and the client already skips glimpse in that case, so this duplicates functionality from the higher layers.

More seriously, patch:
"LU-14526 flr: mirror split downgrade SOM"
(https://review.whamcloud.com/43168/)
Made it possible to have LCM_FL_RDONLY but not strict SOM, so this assumption is no longer correct.

The fix is to not look at LCM_FL_RDONLY when deciding whether to glimpse a file for size.

WC-bug-id: https://jira.whamcloud.com/browse/LU-15609
Lustre-commit: 250108ad754cfa932 ("LU-15609 flr: Don't assume RDONLY implies SOM")

Reviewed-on: https://review.whamcloud.com/46666

---
 fs/lustre/include/obd_support.h | 7 +++----
 fs/lustre/lov/lov_io.c          | 7 -------
 2 files changed, 3 insertions(+), 11 deletions(-)
fs/lustre/include/obd_support.h +3 -4
index 0732fe9a..b6c8a72 100644
@@ -515,10 +515,9 @@
 #define OBD_FAIL_UNKNOWN_LMV_STRIPE			0x1901
 
 /* FLR */
-#define OBD_FAIL_FLR_GLIMPSE_IMMUTABLE			0x1A00
-#define OBD_FAIL_FLR_LV_DELAY			0x1A01
-#define OBD_FAIL_FLR_LV_INC			0x1A02
-#define OBD_FAIL_FLR_RANDOM_PICK_MIRROR	0x1A03
+#define OBD_FAIL_FLR_LV_DELAY				0x1A01
+#define OBD_FAIL_FLR_LV_INC				0x1A02
+#define OBD_FAIL_FLR_RANDOM_PICK_MIRROR			0x1A03
 
 /* LNet is allocated failure locations 0xe000 to 0xffff */
 /* Assign references to moved code to reduce code changes */
fs/lustre/lov/lov_io.c +0 -7
index b535092..32f028b 100644
@@ -540,13 +540,6 @@ static int lov_io_slice_init(struct lov_io *lio, struct lov_object *obj,
 	case CIT_GLIMPSE:
 		lio->lis_pos = 0;
 		lio->lis_endpos = OBD_OBJECT_EOF;
-
-		if (lov_flr_state(obj) == LCM_FL_RDONLY &&
-		    !OBD_FAIL_CHECK(OBD_FAIL_FLR_GLIMPSE_IMMUTABLE)) {
-			/* SoM is accurate, no need glimpse */
-			result = 1;
-			goto out;
-		}
 		break;
 
 	case CIT_MISC:
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#3 lore raw

PATCH 3/32 lustre: echo: remove client operations from echo objects

In reply to James Simmons

From: "John L. Hammond" <[email protected]>

Remove the client (io, page, lock) operations from echo_client objects. This will facilitate the simplification of CLIO.

WC-bug-id: https://jira.whamcloud.com/browse/LU-10994
Lustre-commit: 6060ee55b194e37e8 ("LU-10994 echo: remove client operations from echo objects")

Reviewed-on: https://review.whamcloud.com/47240

---
 fs/lustre/obdecho/echo_client.c | 542 +---------------------------------------
 1 file changed, 8 insertions(+), 534 deletions(-)
fs/lustre/obdecho/echo_client.c +8 -534
index 4cc046a..f25ea41 100644
@@ -70,7 +70,6 @@ struct echo_object {
 	struct echo_device	       *eo_dev;
 	struct list_head		eo_obj_chain;
 	struct lov_oinfo	       *eo_oinfo;
-	atomic_t			eo_npages;
 	int				eo_deleted;
 };
 
@@ -79,19 +78,6 @@ struct echo_object_conf {
 	struct lov_oinfo	      **eoc_oinfo;
 };
 
-struct echo_page {
-	struct cl_page_slice		ep_cl;
-	unsigned long			ep_lock;
-};
-
-struct echo_lock {
-	struct cl_lock_slice		el_cl;
-	struct list_head		el_chain;
-	struct echo_object	       *el_object;
-	u64				el_cookie;
-	atomic_t			el_refcount;
-};
-
 static int echo_client_setup(const struct lu_env *env,
 			     struct obd_device *obd,
 			     struct lustre_cfg *lcfg);
@@ -100,48 +86,34 @@ static int echo_client_setup(const struct lu_env *env,
 /** \defgroup echo_helpers Helper functions
  * @{
  */
-static inline struct echo_device *cl2echo_dev(const struct cl_device *dev)
+static struct echo_device *cl2echo_dev(const struct cl_device *dev)
 {
 	return container_of_safe(dev, struct echo_device, ed_cl);
 }
 
-static inline struct cl_device *echo_dev2cl(struct echo_device *d)
+static struct cl_device *echo_dev2cl(struct echo_device *d)
 {
 	return &d->ed_cl;
 }
 
-static inline struct echo_device *obd2echo_dev(const struct obd_device *obd)
+static struct echo_device *obd2echo_dev(const struct obd_device *obd)
 {
 	return cl2echo_dev(lu2cl_dev(obd->obd_lu_dev));
 }
 
-static inline struct cl_object *echo_obj2cl(struct echo_object *eco)
+static struct cl_object *echo_obj2cl(struct echo_object *eco)
 {
 	return &eco->eo_cl;
 }
 
-static inline struct echo_object *cl2echo_obj(const struct cl_object *o)
+static struct echo_object *cl2echo_obj(const struct cl_object *o)
 {
 	return container_of(o, struct echo_object, eo_cl);
 }
 
-static inline struct echo_page *cl2echo_page(const struct cl_page_slice *s)
-{
-	return container_of(s, struct echo_page, ep_cl);
-}
-
-static inline struct echo_lock *cl2echo_lock(const struct cl_lock_slice *s)
-{
-	return container_of(s, struct echo_lock, el_cl);
-}
-
-static inline struct cl_lock *echo_lock2cl(const struct echo_lock *ecl)
-{
-	return ecl->el_cl.cls_lock;
-}
-
 static struct lu_context_key echo_thread_key;
-static inline struct echo_thread_info *echo_env_info(const struct lu_env *env)
+
+static struct echo_thread_info *echo_env_info(const struct lu_env *env)
 {
 	struct echo_thread_info *info;
 
@@ -158,16 +130,10 @@ struct echo_object_conf *cl2echo_conf(const struct cl_object_conf *c)
 
 /** @} echo_helpers */
 static int cl_echo_object_put(struct echo_object *eco);
-static int cl_echo_object_brw(struct echo_object *eco, int rw, u64 offset,
-			      struct page **pages, int npages, int async);
 
 struct echo_thread_info {
 	struct echo_object_conf		eti_conf;
 	struct lustre_md		eti_md;
-
-	struct cl_2queue		eti_queue;
-	struct cl_io			eti_io;
-	struct cl_lock			eti_lock;
 	struct lu_fid			eti_fid;
 	struct lu_fid			eti_fid2;
 };
@@ -177,18 +143,12 @@ struct echo_session_info {
 	unsigned long			dummy;
 };
 
-static struct kmem_cache *echo_lock_kmem;
 static struct kmem_cache *echo_object_kmem;
 static struct kmem_cache *echo_thread_kmem;
 static struct kmem_cache *echo_session_kmem;
 
 static struct lu_kmem_descr echo_caches[] = {
 	{
-		.ckd_cache = &echo_lock_kmem,
-		.ckd_name  = "echo_lock_kmem",
-		.ckd_size  = sizeof(struct echo_lock)
-	},
-	{
 		.ckd_cache = &echo_object_kmem,
 		.ckd_name  = "echo_object_kmem",
 		.ckd_size  = sizeof(struct echo_object)
@@ -208,191 +168,6 @@ struct echo_session_info {
 	}
 };
 
-/** \defgroup echo_page Page operations
- *
- * Echo page operations.
- *
- * @{
- */
-static int echo_page_own(const struct lu_env *env,
-			 const struct cl_page_slice *slice,
-			 struct cl_io *io, int nonblock)
-{
-	struct echo_page *ep = cl2echo_page(slice);
-
-	if (nonblock) {
-		if (test_and_set_bit(0, &ep->ep_lock))
-			return -EAGAIN;
-	} else {
-		while (test_and_set_bit(0, &ep->ep_lock))
-			wait_on_bit(&ep->ep_lock, 0, TASK_UNINTERRUPTIBLE);
-	}
-	return 0;
-}
-
-static void echo_page_disown(const struct lu_env *env,
-			     const struct cl_page_slice *slice,
-			     struct cl_io *io)
-{
-	struct echo_page *ep = cl2echo_page(slice);
-
-	LASSERT(test_bit(0, &ep->ep_lock));
-	clear_and_wake_up_bit(0, &ep->ep_lock);
-}
-
-static void echo_page_discard(const struct lu_env *env,
-			      const struct cl_page_slice *slice,
-			      struct cl_io *unused)
-{
-	cl_page_delete(env, slice->cpl_page);
-}
-
-static int echo_page_is_vmlocked(const struct lu_env *env,
-				 const struct cl_page_slice *slice)
-{
-	if (test_bit(0, &cl2echo_page(slice)->ep_lock))
-		return -EBUSY;
-	return -ENODATA;
-}
-
-static void echo_page_completion(const struct lu_env *env,
-				 const struct cl_page_slice *slice,
-				 int ioret)
-{
-	LASSERT(slice->cpl_page->cp_sync_io);
-}
-
-static void echo_page_fini(const struct lu_env *env,
-			   struct cl_page_slice *slice,
-			   struct pagevec *pvec)
-{
-	struct echo_object *eco = cl2echo_obj(slice->cpl_obj);
-
-	atomic_dec(&eco->eo_npages);
-	put_page(slice->cpl_page->cp_vmpage);
-}
-
-static int echo_page_prep(const struct lu_env *env,
-			  const struct cl_page_slice *slice,
-			  struct cl_io *unused)
-{
-	return 0;
-}
-
-static int echo_page_print(const struct lu_env *env,
-			   const struct cl_page_slice *slice,
-			   void *cookie, lu_printer_t printer)
-{
-	struct echo_page *ep = cl2echo_page(slice);
-
-	(*printer)(env, cookie, LUSTRE_ECHO_CLIENT_NAME "-page@%p %d vm@%p\n",
-		   ep, test_bit(0, &ep->ep_lock),
-		   slice->cpl_page->cp_vmpage);
-	return 0;
-}
-
-static const struct cl_page_operations echo_page_ops = {
-	.cpo_own		= echo_page_own,
-	.cpo_disown		= echo_page_disown,
-	.cpo_discard		= echo_page_discard,
-	.cpo_fini		= echo_page_fini,
-	.cpo_print		= echo_page_print,
-	.cpo_is_vmlocked	= echo_page_is_vmlocked,
-	.io = {
-		[CRT_READ] = {
-			.cpo_prep	= echo_page_prep,
-			.cpo_completion	= echo_page_completion,
-		},
-		[CRT_WRITE] = {
-			.cpo_prep	= echo_page_prep,
-			.cpo_completion	= echo_page_completion,
-		}
-	}
-};
-
-/** @} echo_page */
-
-/** \defgroup echo_lock Locking
- *
- * echo lock operations
- *
- * @{
- */
-static void echo_lock_fini(const struct lu_env *env,
-			   struct cl_lock_slice *slice)
-{
-	struct echo_lock *ecl = cl2echo_lock(slice);
-
-	LASSERT(list_empty(&ecl->el_chain));
-	kmem_cache_free(echo_lock_kmem, ecl);
-}
-
-static const struct cl_lock_operations echo_lock_ops = {
-	.clo_fini		= echo_lock_fini,
-};
-
-/** @} echo_lock */
-
-/** \defgroup echo_cl_ops cl_object operations
- *
- * operations for cl_object
- *
- * @{
- */
-static int echo_page_init(const struct lu_env *env, struct cl_object *obj,
-			  struct cl_page *page, pgoff_t index)
-{
-	struct echo_page *ep = cl_object_page_slice(obj, page);
-	struct echo_object *eco = cl2echo_obj(obj);
-
-	get_page(page->cp_vmpage);
-	/*
-	 * ep_lock is similar to the lock_page() lock, and
-	 * cannot usefully be monitored by lockdep.
-	 * So just a bit in an "unsigned long" and use the
-	 * wait_on_bit() interface to wait for the bit to be clera.
-	 */
-	ep->ep_lock = 0;
-	cl_page_slice_add(page, &ep->ep_cl, obj, &echo_page_ops);
-	atomic_inc(&eco->eo_npages);
-	return 0;
-}
-
-static int echo_io_init(const struct lu_env *env, struct cl_object *obj,
-			struct cl_io *io)
-{
-	return 0;
-}
-
-static int echo_lock_init(const struct lu_env *env,
-			  struct cl_object *obj, struct cl_lock *lock,
-			  const struct cl_io *unused)
-{
-	struct echo_lock *el;
-
-	el = kmem_cache_zalloc(echo_lock_kmem, GFP_NOFS);
-	if (el) {
-		cl_lock_slice_add(lock, &el->el_cl, obj, &echo_lock_ops);
-		el->el_object = cl2echo_obj(obj);
-		INIT_LIST_HEAD(&el->el_chain);
-		atomic_set(&el->el_refcount, 0);
-	}
-	return !el ? -ENOMEM : 0;
-}
-
-static int echo_conf_set(const struct lu_env *env, struct cl_object *obj,
-			 const struct cl_object_conf *conf)
-{
-	return 0;
-}
-
-static const struct cl_object_operations echo_cl_obj_ops = {
-	.coo_page_init		= echo_page_init,
-	.coo_lock_init		= echo_lock_init,
-	.coo_io_init		= echo_io_init,
-	.coo_conf_set		= echo_conf_set
-};
-
 /** @} echo_cl_ops */
 
 /** \defgroup echo_lu_ops lu_object operations
@@ -434,8 +209,7 @@ static int echo_object_init(const struct lu_env *env, struct lu_object *obj,
 	*econf->eoc_oinfo = NULL;
 
 	eco->eo_dev = ed;
-	atomic_set(&eco->eo_npages, 0);
-	cl_object_page_init(lu2cl(obj), sizeof(struct echo_page));
+	cl_object_page_init(lu2cl(obj), 0);
 
 	spin_lock(&ec->ec_lock);
 	list_add_tail(&eco->eo_obj_chain, &ec->ec_objects);
@@ -455,8 +229,6 @@ static void echo_object_delete(const struct lu_env *env, struct lu_object *obj)
 
 	ec = eco->eo_dev->ed_ec;
 
-	LASSERT(atomic_read(&eco->eo_npages) == 0);
-
 	spin_lock(&ec->ec_lock);
 	list_del_init(&eco->eo_obj_chain);
 	spin_unlock(&ec->ec_lock);
@@ -527,7 +299,6 @@ static struct lu_object *echo_object_alloc(const struct lu_env *env,
 		lu_object_init(obj, &hdr->coh_lu, dev);
 		lu_object_add_top(&hdr->coh_lu, obj);
 
-		eco->eo_cl.co_ops = &echo_cl_obj_ops;
 		obj->lo_ops = &echo_lu_obj_ops;
 	}
 	return obj;
@@ -741,15 +512,6 @@ static struct lu_device *echo_device_fini(const struct lu_env *env,
 	return NULL;
 }
 
-static void echo_lock_release(const struct lu_env *env,
-			      struct echo_lock *ecl,
-			      int still_used)
-{
-	struct cl_lock *clk = echo_lock2cl(ecl);
-
-	cl_lock_release(env, clk);
-}
-
 static struct lu_device *echo_device_free(const struct lu_env *env,
 					  struct lu_device *d)
 {
@@ -934,193 +696,6 @@ static int cl_echo_object_put(struct echo_object *eco)
 	return 0;
 }
 
-static int __cl_echo_enqueue(struct lu_env *env, struct echo_object *eco,
-			     u64 start, u64 end, int mode,
-			     u64 *cookie, u32 enqflags)
-{
-	struct cl_io *io;
-	struct cl_lock *lck;
-	struct cl_object *obj;
-	struct cl_lock_descr *descr;
-	struct echo_thread_info *info;
-	int rc = -ENOMEM;
-
-	info = echo_env_info(env);
-	io = &info->eti_io;
-	lck = &info->eti_lock;
-	obj = echo_obj2cl(eco);
-
-	memset(lck, 0, sizeof(*lck));
-	descr = &lck->cll_descr;
-	descr->cld_obj = obj;
-	descr->cld_start = cl_index(obj, start);
-	descr->cld_end = cl_index(obj, end);
-	descr->cld_mode = mode == LCK_PW ? CLM_WRITE : CLM_READ;
-	descr->cld_enq_flags = enqflags;
-	io->ci_obj = obj;
-
-	rc = cl_lock_request(env, io, lck);
-	if (rc == 0) {
-		struct echo_client_obd *ec = eco->eo_dev->ed_ec;
-		struct echo_lock *el;
-
-		el = cl2echo_lock(cl_lock_at(lck, &echo_device_type));
-		spin_lock(&ec->ec_lock);
-		if (list_empty(&el->el_chain)) {
-			list_add(&el->el_chain, &ec->ec_locks);
-			el->el_cookie = ++ec->ec_unique;
-		}
-		atomic_inc(&el->el_refcount);
-		*cookie = el->el_cookie;
-		spin_unlock(&ec->ec_lock);
-	}
-	return rc;
-}
-
-static int __cl_echo_cancel(struct lu_env *env, struct echo_device *ed,
-			    u64 cookie)
-{
-	struct echo_client_obd *ec = ed->ed_ec;
-	struct echo_lock *ecl = NULL;
-	int found = 0, still_used = 0;
-
-	spin_lock(&ec->ec_lock);
-	list_for_each_entry(ecl, &ec->ec_locks, el_chain) {
-		CDEBUG(D_INFO, "ecl: %p, cookie: %#llx\n", ecl, ecl->el_cookie);
-		found = (ecl->el_cookie == cookie);
-		if (found) {
-			if (atomic_dec_and_test(&ecl->el_refcount))
-				list_del_init(&ecl->el_chain);
-			else
-				still_used = 1;
-			break;
-		}
-	}
-	spin_unlock(&ec->ec_lock);
-
-	if (!found)
-		return -ENOENT;
-
-	echo_lock_release(env, ecl, still_used);
-	return 0;
-}
-
-static void echo_commit_callback(const struct lu_env *env, struct cl_io *io,
-				 struct pagevec *pvec)
-{
-	struct echo_thread_info *info;
-	struct cl_2queue *queue;
-	int i = 0;
-
-	info = echo_env_info(env);
-	LASSERT(io == &info->eti_io);
-
-	queue = &info->eti_queue;
-
-	for (i = 0; i < pagevec_count(pvec); i++) {
-		struct page *vmpage = pvec->pages[i];
-		struct cl_page *page = (struct cl_page *)vmpage->private;
-
-		cl_page_list_add(&queue->c2_qout, page, true);
-	}
-}
-
-static int cl_echo_object_brw(struct echo_object *eco, int rw, u64 offset,
-			      struct page **pages, int npages, int async)
-{
-	struct lu_env *env;
-	struct echo_thread_info *info;
-	struct cl_object *obj = echo_obj2cl(eco);
-	struct echo_device *ed  = eco->eo_dev;
-	struct cl_2queue *queue;
-	struct cl_io *io;
-	struct cl_page *clp;
-	struct lustre_handle lh = { 0 };
-	size_t page_size = cl_page_size(obj);
-	u16 refcheck;
-	int rc;
-	int i;
-
-	LASSERT((offset & ~PAGE_MASK) == 0);
-	LASSERT(ed->ed_next);
-	env = cl_env_get(&refcheck);
-	if (IS_ERR(env))
-		return PTR_ERR(env);
-
-	info = echo_env_info(env);
-	io = &info->eti_io;
-	queue = &info->eti_queue;
-
-	cl_2queue_init(queue);
-
-	io->ci_ignore_layout = 1;
-	rc = cl_io_init(env, io, CIT_MISC, obj);
-	if (rc < 0)
-		goto out;
-	LASSERT(rc == 0);
-
-	rc = __cl_echo_enqueue(env, eco, offset,
-			       offset + npages * PAGE_SIZE - 1,
-			       rw == READ ? LCK_PR : LCK_PW, &lh.cookie,
-			       CEF_NEVER);
-	if (rc < 0)
-		goto error_lock;
-
-	for (i = 0; i < npages; i++) {
-		LASSERT(pages[i]);
-		clp = cl_page_find(env, obj, cl_index(obj, offset),
-				   pages[i], CPT_TRANSIENT);
-		if (IS_ERR(clp)) {
-			rc = PTR_ERR(clp);
-			break;
-		}
-		LASSERT(clp->cp_type == CPT_TRANSIENT);
-
-		rc = cl_page_own(env, io, clp);
-		if (rc) {
-			LASSERT(clp->cp_state == CPS_FREEING);
-			cl_page_put(env, clp);
-			break;
-		}
-		/*
-		 * Add a page to the incoming page list of 2-queue.
-		 */
-		cl_page_list_add(&queue->c2_qin, clp, true);
-
-		/* drop the reference count for cl_page_find, so that the page
-		 * will be freed in cl_2queue_fini.
-		 */
-		cl_page_put(env, clp);
-		cl_page_clip(env, clp, 0, page_size);
-
-		offset += page_size;
-	}
-
-	if (rc == 0) {
-		enum cl_req_type typ = rw == READ ? CRT_READ : CRT_WRITE;
-
-		async = async && (typ == CRT_WRITE);
-		if (async)
-			rc = cl_io_commit_async(env, io, &queue->c2_qin,
-						0, PAGE_SIZE,
-						echo_commit_callback);
-		else
-			rc = cl_io_submit_sync(env, io, typ, queue, 0);
-		CDEBUG(D_INFO, "echo_client %s write returns %d\n",
-		       async ? "async" : "sync", rc);
-	}
-
-	__cl_echo_cancel(env, ed, lh.cookie);
-error_lock:
-	cl_2queue_discard(env, io, queue);
-	cl_2queue_disown(env, io, queue);
-	cl_2queue_fini(env, queue);
-	cl_io_fini(env, io);
-out:
-	cl_env_put(env, &refcheck);
-	return rc;
-}
-
 /** @} echo_exports */
 
 static u64 last_object_id;
@@ -1264,101 +839,6 @@ static int echo_client_page_debug_check(struct page *page, u64 id,
 	return rc;
 }
 
-static int echo_client_kbrw(struct echo_device *ed, int rw, struct obdo *oa,
-			    struct echo_object *eco, u64 offset,
-			    u64 count, int async)
-{
-	u32 npages;
-	struct brw_page	*pga;
-	struct brw_page	*pgp;
-	struct page **pages;
-	u64 off;
-	int i;
-	int rc;
-	int verify;
-	gfp_t gfp_mask;
-	int brw_flags = 0;
-
-	verify = (ostid_id(&oa->o_oi) != ECHO_PERSISTENT_OBJID &&
-		  (oa->o_valid & OBD_MD_FLFLAGS) != 0 &&
-		  (oa->o_flags & OBD_FL_DEBUG_CHECK) != 0);
-
-	gfp_mask = ((ostid_id(&oa->o_oi) & 2) == 0) ? GFP_KERNEL : GFP_HIGHUSER;
-
-	LASSERT(rw == OBD_BRW_WRITE || rw == OBD_BRW_READ);
-
-	if (count <= 0 ||
-	    (count & (~PAGE_MASK)) != 0)
-		return -EINVAL;
-
-	/* XXX think again with misaligned I/O */
-	npages = count >> PAGE_SHIFT;
-
-	if (rw == OBD_BRW_WRITE)
-		brw_flags = OBD_BRW_ASYNC;
-
-	pga = kcalloc(npages, sizeof(*pga), GFP_NOFS);
-	if (!pga)
-		return -ENOMEM;
-
-	pages = kvmalloc_array(npages, sizeof(*pages),
-			       GFP_KERNEL | __GFP_ZERO);
-	if (!pages) {
-		kfree(pga);
-		return -ENOMEM;
-	}
-
-	for (i = 0, pgp = pga, off = offset;
-	     i < npages;
-	     i++, pgp++, off += PAGE_SIZE) {
-		LASSERT(!pgp->pg);      /* for cleanup */
-
-		rc = -ENOMEM;
-		pgp->pg = alloc_page(gfp_mask);
-		if (!pgp->pg)
-			goto out;
-
-		/* set mapping so page is not considered encrypted */
-		pgp->pg->mapping = ECHO_MAPPING_UNENCRYPTED;
-		pages[i] = pgp->pg;
-		pgp->count = PAGE_SIZE;
-		pgp->off = off;
-		pgp->flag = brw_flags;
-
-		if (verify)
-			echo_client_page_debug_setup(pgp->pg, rw,
-						     ostid_id(&oa->o_oi), off,
-						     pgp->count);
-	}
-
-	/* brw mode can only be used at client */
-	LASSERT(ed->ed_next);
-	rc = cl_echo_object_brw(eco, rw, offset, pages, npages, async);
-
-out:
-	if (rc != 0 || rw != OBD_BRW_READ)
-		verify = 0;
-
-	for (i = 0, pgp = pga; i < npages; i++, pgp++) {
-		if (!pgp->pg)
-			continue;
-
-		if (verify) {
-			int vrc;
-
-			vrc = echo_client_page_debug_check(pgp->pg,
-							   ostid_id(&oa->o_oi),
-							   pgp->off, pgp->count);
-			if (vrc != 0 && rc == 0)
-				rc = vrc;
-		}
-		__free_page(pgp->pg);
-	}
-	kfree(pga);
-	kvfree(pages);
-	return rc;
-}
-
 static int echo_client_prep_commit(const struct lu_env *env,
 				   struct obd_export *exp, int rw,
 				   struct obdo *oa, struct echo_object *eco,
@@ -1491,12 +971,6 @@ static int echo_client_brw_ioctl(const struct lu_env *env, int rw,
 		data->ioc_plen1 = PTLRPC_MAX_BRW_SIZE;
 
 	switch (test_mode) {
-	case 1:
-		/* fall through */
-	case 2:
-		rc = echo_client_kbrw(ed, rw, oa, eco, data->ioc_offset,
-				      data->ioc_count, async);
-		break;
 	case 3:
 		rc = echo_client_prep_commit(env, ec->ec_exp, rw, oa, eco,
 					     data->ioc_offset, data->ioc_count,
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#4 lore raw

PATCH 4/32 lustre: clio: remove cl_page_export() and cl_page_is_vmlocked()

In reply to James Simmons

From: "John L. Hammond" <[email protected]>

Remove cl_page_export() and cl_page_is_vmlocked(), replacing them with direct calls to PageSetUptodate() and PageLoecked().

WC-bug-id: https://jira.whamcloud.com/browse/LU-10994
Lustre-commit: 3d52a7c5753e80e78 ("LU-10994 clio: remove cl_page_export() and cl_page_is_vmlocked()")

Reviewed-on: https://review.whamcloud.com/47241

---
 fs/lustre/include/cl_object.h | 22 ---------------------
 fs/lustre/llite/file.c        |  2 +-
 fs/lustre/llite/rw.c          |  4 ++--
 fs/lustre/llite/vvp_page.c    | 31 +----------------------------
 fs/lustre/lov/lov_page.c      |  2 +-
 fs/lustre/obdclass/cl_io.c    |  1 -
 fs/lustre/obdclass/cl_page.c  | 46 -------------------------------------------
 fs/lustre/osc/osc_lock.c      |  2 +-
 8 files changed, 6 insertions(+), 104 deletions(-)
fs/lustre/include/cl_object.h +0 -22
index 5be89d6..db5f610 100644
@@ -872,26 +872,6 @@ struct cl_page_operations {
 			     const struct cl_page_slice *slice,
 			     struct cl_io *io);
 	/**
-	 * Announces whether the page contains valid data or not by @uptodate.
-	 *
-	 * \see cl_page_export()
-	 * \see vvp_page_export()
-	 */
-	void  (*cpo_export)(const struct lu_env *env,
-			    const struct cl_page_slice *slice, int uptodate);
-	/**
-	 * Checks whether underlying VM page is locked (in the suitable
-	 * sense). Used for assertions.
-	 *
-	 * Return:	-EBUSY means page is protected by a lock of a given
-	 *		mode;
-	 *		-ENODATA when page is not protected by a lock;
-	 *		0 this layer cannot decide. (Should never happen.)
-	 */
-	int (*cpo_is_vmlocked)(const struct lu_env *env,
-			       const struct cl_page_slice *slice);
-
-	/**
 	 * Update file attributes when all we have is this page.  Used for tiny
 	 * writes to update attributes when we don't have a full cl_io.
 	 */
@@ -2346,10 +2326,8 @@ int cl_page_flush(const struct lu_env *env, struct cl_io *io,
 void cl_page_discard(const struct lu_env *env, struct cl_io *io,
 		     struct cl_page *pg);
 void cl_page_delete(const struct lu_env *env, struct cl_page *pg);
-int cl_page_is_vmlocked(const struct lu_env *env, const struct cl_page *pg);
 void cl_page_touch(const struct lu_env *env, const struct cl_page *pg,
 		   size_t to);
-void cl_page_export(const struct lu_env *env, struct cl_page *pg, int uptodate);
 loff_t cl_offset(const struct cl_object *obj, pgoff_t idx);
 pgoff_t cl_index(const struct cl_object *obj, loff_t offset);
 size_t cl_page_size(const struct cl_object *obj);
fs/lustre/llite/file.c +1 -1
index efe117d..0e71b3a 100644
@@ -587,7 +587,7 @@ void ll_dom_finish_open(struct inode *inode, struct ptlrpc_request *req)
 			put_page(vmpage);
 			break;
 		}
-		cl_page_export(env, page, 1);
+		SetPageUptodate(vmpage);
 		cl_page_put(env, page);
 		unlock_page(vmpage);
 		put_page(vmpage);
fs/lustre/llite/rw.c +2 -2
index c807217..478ef1b 100644
@@ -1664,7 +1664,7 @@ int ll_io_read_page(const struct lu_env *env, struct cl_io *io,
 	cl_2queue_init(queue);
 	if (uptodate) {
 		vpg->vpg_ra_used = 1;
-		cl_page_export(env, page, 1);
+		SetPageUptodate(page->cp_vmpage);
 		cl_page_disown(env, io, page);
 	} else {
 		anchor = &vvp_env_info(env)->vti_anchor;
@@ -1908,7 +1908,7 @@ int ll_readpage(struct file *file, struct page *vmpage)
 		/* export the page and skip io stack */
 		if (result == 0) {
 			vpg->vpg_ra_used = 1;
-			cl_page_export(env, page, 1);
+			SetPageUptodate(vmpage);
 		} else {
 			ll_ra_stats_inc_sbi(sbi, RA_STAT_FAILED_FAST_READ);
 		}
fs/lustre/llite/vvp_page.c +1 -30
index 7744e9b..82ce5ab 100644
@@ -170,26 +170,6 @@ static void vvp_page_delete(const struct lu_env *env,
 	 */
 }
 
-static void vvp_page_export(const struct lu_env *env,
-			    const struct cl_page_slice *slice,
-			    int uptodate)
-{
-	struct page *vmpage = cl2vm_page(slice);
-
-	LASSERT(vmpage);
-	LASSERT(PageLocked(vmpage));
-	if (uptodate)
-		SetPageUptodate(vmpage);
-	else
-		ClearPageUptodate(vmpage);
-}
-
-static int vvp_page_is_vmlocked(const struct lu_env *env,
-				const struct cl_page_slice *slice)
-{
-	return PageLocked(cl2vm_page(slice)) ? -EBUSY : -ENODATA;
-}
-
 static int vvp_page_prep_read(const struct lu_env *env,
 			      const struct cl_page_slice *slice,
 			      struct cl_io *unused)
@@ -260,7 +240,7 @@ static void vvp_page_completion_read(const struct lu_env *env,
 
 	if (ioret == 0)  {
 		if (!vpg->vpg_defer_uptodate)
-			cl_page_export(env, page, 1);
+			SetPageUptodate(vmpage);
 	} else if (vpg->vpg_defer_uptodate) {
 		vpg->vpg_defer_uptodate = 0;
 		if (ioret == -EAGAIN) {
@@ -382,8 +362,6 @@ static int vvp_page_fail(const struct lu_env *env,
 	.cpo_disown		= vvp_page_disown,
 	.cpo_discard		= vvp_page_discard,
 	.cpo_delete		= vvp_page_delete,
-	.cpo_export		= vvp_page_export,
-	.cpo_is_vmlocked	= vvp_page_is_vmlocked,
 	.cpo_fini		= vvp_page_fini,
 	.cpo_print		= vvp_page_print,
 	.io = {
@@ -412,15 +390,8 @@ static void vvp_transient_page_discard(const struct lu_env *env,
 	cl_page_delete(env, page);
 }
 
-static int vvp_transient_page_is_vmlocked(const struct lu_env *env,
-					  const struct cl_page_slice *slice)
-{
-	return -EBUSY;
-}
-
 static const struct cl_page_operations vvp_transient_page_ops = {
 	.cpo_discard		= vvp_transient_page_discard,
-	.cpo_is_vmlocked	= vvp_transient_page_is_vmlocked,
 	.cpo_print		= vvp_page_print,
 };
 
fs/lustre/lov/lov_page.c +1 -1
index bd6ba79..a22b71f 100644
@@ -144,7 +144,7 @@ int lov_page_init_empty(const struct lu_env *env, struct cl_object *obj,
 	addr = kmap(page->cp_vmpage);
 	memset(addr, 0, cl_page_size(obj));
 	kunmap(page->cp_vmpage);
-	cl_page_export(env, page, 1);
+	SetPageUptodate(page->cp_vmpage);
 	return 0;
 }
 
fs/lustre/obdclass/cl_io.c +0 -1
index 6dd029a..c97ac0f 100644
@@ -849,7 +849,6 @@ void cl_page_list_del(const struct lu_env *env, struct cl_page_list *plist,
 		      struct cl_page *page)
 {
 	LASSERT(plist->pl_nr > 0);
-	LASSERT(cl_page_is_vmlocked(env, page));
 
 	list_del_init(&page->cp_batch);
 	--plist->pl_nr;
fs/lustre/obdclass/cl_page.c +0 -46

52 lines not on this page · raw message

fs/lustre/osc/osc_lock.c +1 -1
index eb3cb58..c8f8502 100644
@@ -644,7 +644,7 @@ static bool weigh_cb(const struct lu_env *env, struct cl_io *io,
 		struct osc_page *ops = pvec[i];
 		struct cl_page *page = ops->ops_cl.cpl_page;
 
-		if (cl_page_is_vmlocked(env, page) ||
+		if (PageLocked(page->cp_vmpage) ||
 		    PageDirty(page->cp_vmpage) ||
 		    PageWriteback(page->cp_vmpage))
 			return false;
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#5 lore raw

PATCH 5/32 lustre: clio: remove cpo_own and cpo_disown

In reply to James Simmons

From: "John L. Hammond" <[email protected]>

Remove the cpo_own and cpo_disown methods from struct cl_page_operations. These methods were only implemented by the vvp layer so they can be inlined into cl_page_own0() and cl_page_disown(). Move most of vvp_page_discard() and all of vvp_transient_page_discard() into cl_page_discard().

WC-bug-id: https://jira.whamcloud.com/browse/LU-10994
Lustre-commit: 81c6dc423ce4c62a6 ("LU-10994 clio: remove cpo_own and cpo_disown")

Reviewed-on: https://review.whamcloud.com/47372

---
 fs/lustre/include/cl_object.h  | 33 ++++----------
 fs/lustre/llite/llite_lib.c    |  2 +-
 fs/lustre/llite/rw.c           | 49 +++++++++++----------
 fs/lustre/llite/rw26.c         |  6 +--
 fs/lustre/llite/vvp_dev.c      |  3 +-
 fs/lustre/llite/vvp_internal.h |  3 --
 fs/lustre/llite/vvp_page.c     | 86 ++++++------------------------------
 fs/lustre/obdclass/cl_io.c     | 12 +++--
 fs/lustre/obdclass/cl_page.c   | 99 +++++++++++++++++++++++-------------------
 9 files changed, 112 insertions(+), 181 deletions(-)
fs/lustre/include/cl_object.h +8 -25
index db5f610..4460ae1 100644
@@ -764,6 +764,10 @@ struct cl_page {
 	 * creation.
 	 */
 	enum cl_page_type		 cp_type:CP_TYPE_BITS;
+	unsigned int			 cp_defer_uptodate:1,
+					 cp_ra_updated:1,
+					 cp_ra_used:1;
+
 	/* which slab kmem index this memory allocated from */
 	short int			 cp_kmem_index;
 
@@ -822,7 +826,7 @@ enum cl_req_type {
  *
  * Methods taking an @io argument are for the activity happening in the
  * context of given @io. Page is assumed to be owned by that io, except for
- * the obvious cases (like cl_page_operations::cpo_own()).
+ * the obvious cases.
  *
  * \see vvp_page_ops, lov_page_ops, osc_page_ops
  */
@@ -834,25 +838,6 @@ struct cl_page_operations {
 	 */
 
 	/**
-	 * Called when @io acquires this page into the exclusive
-	 * ownership. When this method returns, it is guaranteed that the is
-	 * not owned by other io, and no transfer is going on against
-	 * it. Optional.
-	 *
-	 * \see cl_page_own()
-	 * \see vvp_page_own(), lov_page_own()
-	 */
-	int  (*cpo_own)(const struct lu_env *env,
-			const struct cl_page_slice *slice,
-			struct cl_io *io, int nonblock);
-	/** Called when ownership it yielded. Optional.
-	 *
-	 * \see cl_page_disown()
-	 * \see vvp_page_disown()
-	 */
-	void (*cpo_disown)(const struct lu_env *env,
-			   const struct cl_page_slice *slice, struct cl_io *io);
-	/**
 	 * Called for a page that is already "owned" by @io from VM point of
 	 * view. Optional.
 	 *
@@ -2290,8 +2275,7 @@ void cl_page_unassume(const struct lu_env *env,
 		      struct cl_io *io, struct cl_page *pg);
 void cl_page_disown(const struct lu_env *env,
 		    struct cl_io *io, struct cl_page *page);
-void __cl_page_disown(const struct lu_env *env,
-		      struct cl_io *io, struct cl_page *pg);
+void __cl_page_disown(const struct lu_env *env, struct cl_page *pg);
 int cl_page_is_owned(const struct cl_page *pg, const struct cl_io *io);
 
 /** @} ownership */
@@ -2544,14 +2528,13 @@ void cl_page_list_splice(struct cl_page_list *list,
 void cl_page_list_del(const struct lu_env *env,
 		      struct cl_page_list *plist, struct cl_page *page);
 void cl_page_list_disown(const struct lu_env *env,
-			 struct cl_io *io, struct cl_page_list *plist);
+			 struct cl_page_list *plist);
 void cl_page_list_discard(const struct lu_env *env,
 			  struct cl_io *io, struct cl_page_list *plist);
 void cl_page_list_fini(const struct lu_env *env, struct cl_page_list *plist);
 
 void cl_2queue_init(struct cl_2queue *queue);
-void cl_2queue_disown(const struct lu_env *env, struct cl_io *io,
-		      struct cl_2queue *queue);
+void cl_2queue_disown(const struct lu_env *env, struct cl_2queue *queue);
 void cl_2queue_discard(const struct lu_env *env, struct cl_io *io,
 		       struct cl_2queue *queue);
 void cl_2queue_fini(const struct lu_env *env, struct cl_2queue *queue);
fs/lustre/llite/llite_lib.c +1 -1
index 6adbf10..b55a30f 100644
@@ -1955,7 +1955,7 @@ int ll_io_zero_page(struct inode *inode, pgoff_t index, pgoff_t offset,
 queuefini2:
 		cl_2queue_discard(env, io, queue);
 queuefini1:
-		cl_2queue_disown(env, io, queue);
+		cl_2queue_disown(env, queue);
 		cl_2queue_fini(env, queue);
 	}
 
fs/lustre/llite/rw.c +25 -24

124 lines not on this page · raw message

fs/lustre/llite/rw26.c +3 -3
index 8b379ca..7147f0f 100644
@@ -286,7 +286,7 @@ static unsigned long ll_iov_iter_alignment(struct iov_iter *i)
 	}
 
 	cl_2queue_discard(env, io, queue);
-	cl_2queue_disown(env, io, queue);
+	cl_2queue_disown(env, queue);
 	cl_2queue_fini(env, queue);
 	return rc;
 }
@@ -468,8 +468,8 @@ static int ll_prepare_partial_page(const struct lu_env *env, struct cl_io *io,
 		goto out;
 	}
 
-	if (vpg->vpg_defer_uptodate) {
-		vpg->vpg_ra_used = 1;
+	if (pg->cp_defer_uptodate) {
+		pg->cp_ra_used = 1;
 		result = 0;
 		goto out;
 	}
fs/lustre/llite/vvp_dev.c +1 -2
index 0c417d8..99335bd 100644
@@ -435,11 +435,10 @@ static void vvp_pgcache_page_show(const struct lu_env *env,
 
 	vpg = cl2vvp_page(cl_page_at(page, &vvp_device_type));
 	vmpage = vpg->vpg_page;
-	seq_printf(seq, " %5i | %p %p %s %s %s | %p " DFID "(%p) %lu %u [",
+	seq_printf(seq, " %5i | %p %p %s %s | %p " DFID "(%p) %lu %u [",
 		   0 /* gen */,
 		   vpg, page,
 		   "none",
-		   vpg->vpg_defer_uptodate ? "du" : "- ",
 		   PageWriteback(vmpage) ? "wb" : "-",
 		   vmpage, PFID(ll_inode2fid(vmpage->mapping->host)),
 		   vmpage->mapping->host, vmpage->index,
fs/lustre/llite/vvp_internal.h +0 -3
index b5e1df2..0e0da76 100644
@@ -213,9 +213,6 @@ struct vvp_object {
  */
 struct vvp_page {
 	struct cl_page_slice	vpg_cl;
-	unsigned int		vpg_defer_uptodate:1,
-				vpg_ra_updated:1,
-				vpg_ra_used:1;
 	/** VM page */
 	struct page		*vpg_page;
 };
fs/lustre/llite/vvp_page.c +14 -72

144 lines not on this page · raw message

fs/lustre/obdclass/cl_io.c +5 -7
index c97ac0f..4246e17 100644
@@ -911,8 +911,7 @@ void cl_page_list_splice(struct cl_page_list *src, struct cl_page_list *dst)
 /**
  * Disowns pages in a queue.
  */
-void cl_page_list_disown(const struct lu_env *env,
-			 struct cl_io *io, struct cl_page_list *plist)
+void cl_page_list_disown(const struct lu_env *env, struct cl_page_list *plist)
 {
 	struct cl_page *page;
 	struct cl_page *temp;
@@ -930,7 +929,7 @@ void cl_page_list_disown(const struct lu_env *env,
 		/*
 		 * XXX __cl_page_disown() will fail if page is not locked.
 		 */
-		__cl_page_disown(env, io, page);
+		__cl_page_disown(env, page);
 		lu_ref_del_at(&page->cp_reference, &page->cp_queue_ref, "queue",
 			      plist);
 		cl_page_put(env, page);
@@ -990,11 +989,10 @@ void cl_2queue_init(struct cl_2queue *queue)
 /**
  * Disown pages in both lists of a 2-queue.
  */
-void cl_2queue_disown(const struct lu_env *env,
-		      struct cl_io *io, struct cl_2queue *queue)
+void cl_2queue_disown(const struct lu_env *env, struct cl_2queue *queue)
 {
-	cl_page_list_disown(env, io, &queue->c2_qin);
-	cl_page_list_disown(env, io, &queue->c2_qout);
+	cl_page_list_disown(env, &queue->c2_qin);
+	cl_page_list_disown(env, &queue->c2_qout);
 }
 EXPORT_SYMBOL(cl_2queue_disown);
 
fs/lustre/obdclass/cl_page.c +55 -44

167 lines not on this page · raw message

Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#6 lore raw

PATCH 6/32 lustre: clio: remove cpo_assume, cpo_unassume, cpo_fini

In reply to James Simmons

From: "John L. Hammond" <[email protected]>

Remove the cl_page methods cpo_assume, cpo_unassume, and cpo_fini. These methods were only implemented by the vvp layer and so they can be easily inlined into cl_page_assume() and cl_page_unassume(). Remove vvp_page_delete() by inlining its contents to cl_page_delete0().

WC-bug-id: https://jira.whamcloud.com/browse/LU-10994
Lustre-commit: 9045894fe0f503333 ("LU-10994 clio: remove cpo_assume, cpo_unassume, cpo_fini")

Reviewed-on: https://review.whamcloud.com/47373

---
 fs/lustre/include/cl_object.h |  23 --------
 fs/lustre/llite/vvp_page.c    |  71 +------------------------
 fs/lustre/obdclass/cl_page.c  | 119 +++++++++++++++++++++++++-----------------
 3 files changed, 73 insertions(+), 140 deletions(-)
fs/lustre/include/cl_object.h +0 -23
index 4460ae1..c66e98c5 100644
@@ -838,25 +838,6 @@ struct cl_page_operations {
 	 */
 
 	/**
-	 * Called for a page that is already "owned" by @io from VM point of
-	 * view. Optional.
-	 *
-	 * \see cl_page_assume()
-	 * \see vvp_page_assume(), lov_page_assume()
-	 */
-	void (*cpo_assume)(const struct lu_env *env,
-			   const struct cl_page_slice *slice, struct cl_io *io);
-	/** Dual to cl_page_operations::cpo_assume(). Optional. Called
-	 * bottom-to-top when IO releases a page without actually unlocking
-	 * it.
-	 *
-	 * \see cl_page_unassume()
-	 * \see vvp_page_unassume()
-	 */
-	void (*cpo_unassume)(const struct lu_env *env,
-			     const struct cl_page_slice *slice,
-			     struct cl_io *io);
-	/**
 	 * Update file attributes when all we have is this page.  Used for tiny
 	 * writes to update attributes when we don't have a full cl_io.
 	 */
@@ -884,10 +865,6 @@ struct cl_page_operations {
 	 */
 	void (*cpo_delete)(const struct lu_env *env,
 			   const struct cl_page_slice *slice);
-	/** Destructor. Frees resources and slice itself. */
-	void (*cpo_fini)(const struct lu_env *env,
-			 struct cl_page_slice *slice,
-			 struct pagevec *pvec);
 	/**
 	 * Optional debugging helper. Prints given page slice.
 	 *
fs/lustre/llite/vvp_page.c +1 -70

96 lines not on this page · raw message

fs/lustre/obdclass/cl_page.c +72 -47

177 lines not on this page · raw message

Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#7 lore raw

PATCH 7/32 lustre: enc: enc-unaware clients get ENOKEY if file not found

In reply to James Simmons

From: Sebastien Buisson <[email protected]>

To reduce issues with applications running on clients without keys or without fscrypt support that check for the existence of a file in an encrypted directory, return -ENOKEY instead of -ENOENT. For encryption-unaware clients, this is done on server side in the mdt layer, by checking if clients have the OBD_CONNECT2_ENCRYPT connection flag.
For clients without the key, this is done in llite when the searched filename is not in encoded form.

WC-bug-id: https://jira.whamcloud.com/browse/LU-15855
Lustre-commit: 00898697f998c095e ("LU-15855 enc: enc-unaware clients get ENOKEY if file not found")

Reviewed-on: https://review.whamcloud.com/47349

---
 fs/lustre/llite/crypto.c | 35 ++++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 15 deletions(-)
fs/lustre/llite/crypto.c +20 -15
index f075b9a..ad045c3 100644
@@ -233,21 +233,26 @@ int ll_setup_filename(struct inode *dir, const struct qstr *iname,
 		fid->f_ver = 0;
 	}
 	rc = fscrypt_setup_filename(dir, &dname, lookup, fname);
-	if (rc == -ENOENT && lookup &&
-	    ((is_root_inode(dir) && iname->len == strlen(dot_fscrypt_name) &&
-	      strncmp(iname->name, dot_fscrypt_name, iname->len) == 0) ||
-	     (!fscrypt_has_encryption_key(dir) &&
-	      unlikely(filename_is_volatile(iname->name, iname->len, NULL))))) {
-		/* In case of subdir mount of an encrypted directory, we allow
-		 * lookup of /.fscrypt directory.
-		 */
-		/* For purpose of migration or mirroring without enc key, we
-		 * allow lookup of volatile file without enc context.
-		 */
-		memset(fname, 0, sizeof(struct fscrypt_name));
-		fname->disk_name.name = (unsigned char *)iname->name;
-		fname->disk_name.len = iname->len;
-		rc = 0;
+	if (rc == -ENOENT && lookup) {
+		if (((is_root_inode(dir) &&
+		     iname->len == strlen(dot_fscrypt_name) &&
+		     strncmp(iname->name, dot_fscrypt_name, iname->len) == 0) ||
+		     (!fscrypt_has_encryption_key(dir) &&
+		      unlikely(filename_is_volatile(iname->name,
+						    iname->len, NULL))))) {
+			/* In case of subdir mount of an encrypted directory,
+			 * we allow lookup of /.fscrypt directory.
+			 */
+			/* For purpose of migration or mirroring without enc key,
+			 * we allow lookup of volatile file without enc context.
+			 */
+			memset(fname, 0, sizeof(struct fscrypt_name));
+			fname->disk_name.name = (unsigned char *)iname->name;
+			fname->disk_name.len = iname->len;
+			rc = 0;
+		} else if (!fscrypt_has_encryption_key(dir)) {
+			rc = -ENOKEY;
+		}
 	}
 	if (rc)
 		return rc;
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#8 lore raw

PATCH 8/32 lnet: socklnd: Duplicate ksock_conn_cb

In reply to James Simmons

From: Chris Horn <[email protected]>

If two threads enter ksocknal_add_peer(), the first one to acquire the ksnd_global_lock will create a ksock_peer_ni and associate a ksock_conn_cb with it.

When the second thread acquires the ksnd_global_lock it will find the existing ksock_peer_ni, but it does not check for an existing ksock_conn_cb. As a result, it overwrites the existing ksock_conn_cb (ksock_peer_ni::ksnp_conn_cb) and the ksock_conn_cb from the first thread becomes stranded.

Modify ksocknal_add_peer() to check whether the peer_ni has an existing ksock_conn_cb associated with it

Fixes 3ffceb7502 ("lnet: socklnd: replace route construct")

HPE-bug-id: LUS-10956
WC-bug-id: https://jira.whamcloud.com/browse/LU-15860
Lustre-commit: 0c91d49a44e1214b5 ("LU-15860 socklnd: Duplicate ksock_conn_cb")

Reviewed-on: https://review.whamcloud.com/47361

---
 net/lnet/klnds/socklnd/socklnd.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
net/lnet/klnds/socklnd/socklnd.c +11 -8
index 01b434f..2b08501 100644
@@ -645,14 +645,17 @@ struct ksock_peer_ni *
 			 nidhash(&id->nid));
 	}
 
-	ksocknal_add_conn_cb_locked(peer_ni, conn_cb);
-
-	/* Remember conns_per_peer setting at the time
-	 * of connection initiation. It will define the
-	 * max number of conns per type for this conn_cb
-	 * while it's in use.
-	 */
-	conn_cb->ksnr_max_conns = ksocknal_get_conns_per_peer(peer_ni);
+	if (peer_ni->ksnp_conn_cb) {
+		ksocknal_conn_cb_decref(conn_cb);
+	} else {
+		ksocknal_add_conn_cb_locked(peer_ni, conn_cb);
+		/* Remember conns_per_peer setting at the time
+		 * of connection initiation. It will define the
+		 * max number of conns per type for this conn_cb
+		 * while it's in use.
+		 */
+		conn_cb->ksnr_max_conns = ksocknal_get_conns_per_peer(peer_ni);
+	}
 
 	write_unlock_bh(&ksocknal_data.ksnd_global_lock);
 
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#9 lore raw

PATCH 9/32 lustre: llite: enforce ROOT default on subdir mount

In reply to James Simmons

From: Lai Siyao <[email protected]>

In subdirectory mount, the filesystem-wide default LMV doesn't take effect. This fix includes the following changes:
* enforce the filesystem-wide default LMV on subdirectory mount if it's not set separately.
* "lfs getdirstripe -D <subdir_mount>" should print the filesystem-wide default LMV.

WC-bug-id: https://jira.whamcloud.com/browse/LU-15910
Lustre-commit: a162e24d2da5e4bd6 ("LU-15910 llite: enforce ROOT default on subdir mount")

Reviewed-on: https://review.whamcloud.com/47518

---
 fs/lustre/llite/dir.c            | 75 ++++++++++++++++++++++++----------------
 fs/lustre/llite/llite_internal.h |  3 ++
 fs/lustre/llite/llite_lib.c      | 46 ++++++++++++++++++++++--
 3 files changed, 93 insertions(+), 31 deletions(-)
fs/lustre/llite/dir.c +46 -29
index 6eaac9a..2b63c48 100644
@@ -655,10 +655,9 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump,
 	return rc;
 }
 
-static int ll_dir_get_default_layout(struct inode *inode, void **plmm,
-				     int *plmm_size,
-				     struct ptlrpc_request **request, u64 valid,
-				     enum get_default_layout_type type)
+int ll_dir_get_default_layout(struct inode *inode, void **plmm, int *plmm_size,
+			      struct ptlrpc_request **request, u64 valid,
+			      enum get_default_layout_type type)
 {
 	struct ll_sb_info *sbi = ll_i2sbi(inode);
 	struct mdt_body *body;
@@ -1627,35 +1626,53 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 
 				lum = (struct lmv_user_md *)lmm;
 				lli = ll_i2info(inode);
-				if (lum->lum_max_inherit == LMV_INHERIT_NONE ||
-				    (lum->lum_max_inherit > 0 &&
-				     lum->lum_max_inherit < lli->lli_dir_depth)) {
-					rc = -ENODATA;
-					goto finish_req;
-				}
+				if (lum->lum_max_inherit !=
+				    LMV_INHERIT_UNLIMITED) {
+					if (lum->lum_max_inherit ==
+						LMV_INHERIT_NONE ||
+					    lum->lum_max_inherit <
+						LMV_INHERIT_END ||
+					    lum->lum_max_inherit >
+						LMV_INHERIT_MAX ||
+					    lum->lum_max_inherit <
+						lli->lli_dir_depth) {
+						rc = -ENODATA;
+						goto finish_req;
+					}
+
+					if (lum->lum_max_inherit ==
+					    lli->lli_dir_depth) {
+						lum->lum_max_inherit =
+							LMV_INHERIT_NONE;
+						lum->lum_max_inherit_rr =
+							LMV_INHERIT_RR_NONE;
+						goto out_copy;
+					}
 
-				if (lum->lum_max_inherit ==
-				    lli->lli_dir_depth) {
-					lum->lum_max_inherit = LMV_INHERIT_NONE;
-					lum->lum_max_inherit_rr =
-						LMV_INHERIT_RR_NONE;
-					goto out_copy;
-				}
-				if (lum->lum_max_inherit > lli->lli_dir_depth &&
-				    lum->lum_max_inherit <= LMV_INHERIT_MAX)
 					lum->lum_max_inherit -=
 						lli->lli_dir_depth;
+				}
 
-				if (lum->lum_max_inherit_rr >
-					lli->lli_dir_depth &&
-				    lum->lum_max_inherit_rr <=
-					LMV_INHERIT_RR_MAX)
-					lum->lum_max_inherit_rr -=
-						lli->lli_dir_depth;
-				else if (lum->lum_max_inherit_rr ==
-						lli->lli_dir_depth)
-					lum->lum_max_inherit_rr =
-						LMV_INHERIT_RR_NONE;
+				if (lum->lum_max_inherit_rr !=
+				    LMV_INHERIT_RR_UNLIMITED) {
+					if (lum->lum_max_inherit_rr ==
+						LMV_INHERIT_NONE ||
+					    lum->lum_max_inherit_rr <
+						LMV_INHERIT_RR_END ||
+					    lum->lum_max_inherit_rr >
+						LMV_INHERIT_RR_MAX ||
+					    lum->lum_max_inherit_rr <=
+						lli->lli_dir_depth) {
+						lum->lum_max_inherit_rr =
+							LMV_INHERIT_RR_NONE;
+						goto out_copy;
+					}
+
+					if (lum->lum_max_inherit_rr >
+					    lli->lli_dir_depth)
+						lum->lum_max_inherit_rr -=
+							lli->lli_dir_depth;
+				}
 			}
 out_copy:
 			if (copy_to_user(ulmv, lmm, lmmsize))
fs/lustre/llite/llite_internal.h +3 -0
index 70a42d4..c350440 100644
@@ -1155,6 +1155,9 @@ int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename,
 			     struct ptlrpc_request **request);
 int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump,
 		     int set_default);
+int ll_dir_get_default_layout(struct inode *inode, void **plmm, int *plmm_size,
+			      struct ptlrpc_request **request, u64 valid,
+			      enum get_default_layout_type type);
 int ll_dir_getstripe_default(struct inode *inode, void **lmmp,
 			     int *lmm_size, struct ptlrpc_request **request,
 			     struct ptlrpc_request **root_request, u64 valid);
fs/lustre/llite/llite_lib.c +44 -2

58 lines not on this page · raw message

Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#10 lore raw

PATCH 10/32 lnet: Replace msg_rdma_force with a new md_flag LNET_MD_FLAG_GPU.

In reply to James Simmons

From: Alexey Lyashkov <[email protected]>

HPE-bug-id: LUS-10520
WC-bug-id: https://jira.whamcloud.com/browse/LU-15189
Lustre-commit: 959304eac7ec5b156 ("LU-15189 lnet: fix memory mapping.")

Reviewed-on: https://review.whamcloud.com/45482

HPE-bug-id: LUS-10997
WC-bug-id: https://jira.whamcloud.com/browse/LU-15914
Lustre-commit: cb0220db3ce517b0e ("LU-15914 lnet: Fix null md deref for finalized message")

---
 fs/lustre/include/lustre_net.h       |  4 +++-
 fs/lustre/osc/osc_request.c          |  3 +++
 fs/lustre/ptlrpc/pers.c              |  3 +++
 include/linux/lnet/lib-types.h       |  3 +--
 include/uapi/linux/lnet/lnet-types.h |  2 ++
 net/lnet/klnds/o2iblnd/o2iblnd.h     | 23 +++++++++++++++--------
 net/lnet/klnds/o2iblnd/o2iblnd_cb.c  | 31 +++++++++++++++++++++----------
 net/lnet/lnet/lib-md.c               |  3 +++
 net/lnet/lnet/lib-move.c             | 10 ++++++----
 9 files changed, 57 insertions(+), 25 deletions(-)
fs/lustre/include/lustre_net.h +3 -1
index 7d29542..f70cc7c 100644
@@ -1186,7 +1186,9 @@ struct ptlrpc_bulk_desc {
 	/** completed with failure */
 	unsigned long			bd_failure:1;
 	/** client side */
-	unsigned long			bd_registered:1;
+	unsigned long			bd_registered:1,
+	/* bulk request is RDMA transfer, use page->host as real address */
+					bd_is_rdma:1;
 	/** For serialization with callback */
 	spinlock_t			bd_lock;
 	/** {put,get}{source,sink}{kiov} */
fs/lustre/osc/osc_request.c +3 -0
index d84884f..21e036e 100644
@@ -1416,6 +1416,7 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli,
 	const char *obd_name = cli->cl_import->imp_obd->obd_name;
 	struct inode *inode = NULL;
 	bool directio = false;
+	bool gpu = 0;
 	bool enable_checksum = true;
 	struct cl_page *clpage;
 
@@ -1581,6 +1582,7 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli,
 	if (brw_page2oap(pga[0])->oap_brw_flags & OBD_BRW_RDMA_ONLY) {
 		enable_checksum = false;
 		short_io_size = 0;
+		gpu = 1;
 	}
 
 	/* Check if read/write is small enough to be a short io. */
@@ -1632,6 +1634,7 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli,
 		goto out;
 	}
 	/* NB request now owns desc and will free it when it gets freed */
+	desc->bd_is_rdma = gpu;
 no_bulk:
 	body = req_capsule_client_get(pill, &RMF_OST_BODY);
 	ioobj = req_capsule_client_get(pill, &RMF_OBD_IOOBJ);
fs/lustre/ptlrpc/pers.c +3 -0
index e24c8e3..b35d2fe 100644
@@ -58,6 +58,9 @@ void ptlrpc_fill_bulk_md(struct lnet_md *md, struct ptlrpc_bulk_desc *desc,
 		return;
 	}
 
+	if (desc->bd_is_rdma)
+		md->options |= LNET_MD_GPU_ADDR;
+
 	if (mdidx == (desc->bd_md_count - 1))
 		md->length = desc->bd_iov_count - start;
 	else
include/linux/lnet/lib-types.h +1 -2
index f7f0b0b..1827f4e 100644
@@ -138,8 +138,6 @@ struct lnet_msg {
 	enum lnet_msg_hstatus	msg_health_status;
 	/* This is a recovery message */
 	bool			msg_recovery;
-	/* force an RDMA even if the message size is < 4K */
-	bool			msg_rdma_force;
 	/* the number of times a transmission has been retried */
 	int			msg_retry_count;
 	/* flag to indicate that we do not want to resend this message */
@@ -245,6 +243,7 @@ struct lnet_libmd {
  */
 #define LNET_MD_FLAG_HANDLING		BIT(3)
 #define LNET_MD_FLAG_DISCARD		BIT(4)
+#define LNET_MD_FLAG_GPU		BIT(5) /**< Special mapping needs */
 
 struct lnet_test_peer {
 	/* info about peers we are trying to fail */
include/uapi/linux/lnet/lnet-types.h +2 -0
index c5fca5c..5a2ea45 100644
@@ -467,6 +467,8 @@ struct lnet_md {
 #define LNET_MD_TRACK_RESPONSE		(1 << 10)
 /** See struct lnet_md::options. */
 #define LNET_MD_NO_TRACK_RESPONSE	(1 << 11)
+/** Special page mapping handling */
+#define LNET_MD_GPU_ADDR		(1 << 13)
 
 /** Infinite threshold on MD operations. See lnet_md::threshold */
 #define LNET_MD_THRESH_INF	(-1)
net/lnet/klnds/o2iblnd/o2iblnd.h +15 -8
index e798695..0066e85 100644
@@ -401,8 +401,9 @@ struct kib_tx {					/* transmit message */
 	struct kib_tx_pool     *tx_pool;	/* pool I'm from */
 	struct kib_conn	       *tx_conn;	/* owning conn */
 	short			tx_sending;	/* # tx callbacks outstanding */
-	short			tx_queued;	/* queued for sending */
-	short			tx_waiting;	/* waiting for peer_ni */
+	unsigned long		tx_queued:1,	/* queued for sending */
+				tx_waiting:1,	/* waiting for peer_ni */
+				tx_gpu:1;	/* force DMA */
 	int			tx_status;	/* LNET completion status */
 	enum lnet_msg_hstatus	tx_hstatus;	/* health status of the transmit */
 	ktime_t			tx_deadline;	/* completion deadline */
@@ -861,17 +862,23 @@ static inline void kiblnd_dma_unmap_single(struct ib_device *dev,
 #define KIBLND_UNMAP_ADDR_SET(p, m, a)	do {} while (0)
 #define KIBLND_UNMAP_ADDR(p, m, a)	(a)
 
-static inline int kiblnd_dma_map_sg(struct kib_hca_dev *hdev,
-				    struct scatterlist *sg, int nents,
-				    enum dma_data_direction direction)
+static inline
+int kiblnd_dma_map_sg(struct kib_hca_dev *hdev, struct kib_tx *tx)
 {
+	struct scatterlist *sg = tx->tx_frags;
+	int nents = tx->tx_nfrags;
+	enum dma_data_direction direction = tx->tx_dmadir;
+
 	return ib_dma_map_sg(hdev->ibh_ibdev, sg, nents, direction);
 }
 
-static inline void kiblnd_dma_unmap_sg(struct kib_hca_dev *hdev,
-				       struct scatterlist *sg, int nents,
-				       enum dma_data_direction direction)
+static inline
+void kiblnd_dma_unmap_sg(struct kib_hca_dev *hdev, struct kib_tx *tx)
 {
+	struct scatterlist *sg = tx->tx_frags;
+	int nents = tx->tx_nfrags;
+	enum dma_data_direction direction = tx->tx_dmadir;
+
 	ib_dma_unmap_sg(hdev->ibh_ibdev, sg, nents, direction);
 }
 
net/lnet/klnds/o2iblnd/o2iblnd_cb.c +21 -10
index cb96282..01fa499 100644
@@ -623,8 +623,7 @@ static void kiblnd_unmap_tx(struct kib_tx *tx)
 		kiblnd_fmr_pool_unmap(&tx->tx_fmr, tx->tx_status);
 
 	if (tx->tx_nfrags) {
-		kiblnd_dma_unmap_sg(tx->tx_pool->tpo_hdev,
-				    tx->tx_frags, tx->tx_nfrags, tx->tx_dmadir);
+		kiblnd_dma_unmap_sg(tx->tx_pool->tpo_hdev, tx);
 		tx->tx_nfrags = 0;
 	}
 }
@@ -644,9 +643,7 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,
 	tx->tx_dmadir = (rd != tx->tx_rd) ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
 	tx->tx_nfrags = nfrags;
 
-	rd->rd_nfrags = kiblnd_dma_map_sg(hdev, tx->tx_frags,
-					  tx->tx_nfrags, tx->tx_dmadir);
-
+	rd->rd_nfrags = kiblnd_dma_map_sg(hdev, tx);
 	for (i = 0, nob = 0; i < rd->rd_nfrags; i++) {
 		rd->rd_frags[i].rf_nob  = kiblnd_sg_dma_len(
 			hdev->ibh_ibdev, &tx->tx_frags[i]);
@@ -1076,7 +1073,8 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,
 		int prev = dstidx;
 
 		if (srcidx >= srcrd->rd_nfrags) {
-			CERROR("Src buffer exhausted: %d frags\n", srcidx);
+			CERROR("Src buffer exhausted: %d frags %px\n",
+			       srcidx, tx);
 			rc = -EPROTO;
 			break;
 		}
@@ -1540,10 +1538,12 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,
 	struct bio_vec *payload_kiov = lntmsg->msg_kiov;
 	unsigned int payload_offset = lntmsg->msg_offset;
 	unsigned int payload_nob = lntmsg->msg_len;
+	struct lnet_libmd *msg_md = lntmsg->msg_md;
 	struct iov_iter from;
 	struct kib_msg *ibmsg;
 	struct kib_rdma_desc *rd;
 	struct kib_tx *tx;
+	bool gpu;
 	int nob;
 	int rc;
 
@@ -1571,6 +1571,7 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,
 		return -ENOMEM;
 	}
 	ibmsg = tx->tx_msg;
+	gpu = msg_md ? (msg_md->md_flags & LNET_MD_FLAG_GPU) : false;
 
 	switch (type) {
 	default:
@@ -1586,11 +1587,13 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,
 			break;		/* send IMMEDIATE */
 
 		/* is the REPLY message too small for RDMA? */
-		nob = offsetof(struct kib_msg, ibm_u.immediate.ibim_payload[lntmsg->msg_md->md_length]);
-		if (nob <= IBLND_MSG_SIZE && !lntmsg->msg_rdma_force)
+		nob = offsetof(struct kib_msg,
+			       ibm_u.immediate.ibim_payload[lntmsg->msg_md->md_length]);
+		if (nob <= IBLND_MSG_SIZE && !gpu)
 			break;		/* send IMMEDIATE */
 
 		rd = &ibmsg->ibm_u.get.ibgm_rd;
+		tx->tx_gpu = gpu;
 		rc = kiblnd_setup_rd_kiov(ni, tx, rd,
 					  payload_niov, payload_kiov,
 					  payload_offset, payload_nob);
@@ -1626,9 +1629,11 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,
 	case LNET_MSG_PUT:
 		/* Is the payload small enough not to need RDMA? */
 		nob = offsetof(struct kib_msg, ibm_u.immediate.ibim_payload[payload_nob]);
-		if (nob <= IBLND_MSG_SIZE && !lntmsg->msg_rdma_force)
+		if (nob <= IBLND_MSG_SIZE && !gpu)
 			break;			/* send IMMEDIATE */
 
+		tx->tx_gpu = gpu;
+
 		rc = kiblnd_setup_rd_kiov(ni, tx, tx->tx_rd,
 					  payload_niov, payload_kiov,
 					  payload_offset, payload_nob);
@@ -1712,6 +1717,7 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,
 	struct bio_vec *kiov = lntmsg->msg_kiov;
 	unsigned int offset = lntmsg->msg_offset;
 	unsigned int nob = lntmsg->msg_len;
+	struct lnet_libmd *payload_md = lntmsg->msg_md;
 	struct kib_tx *tx;
 	int rc;
 
@@ -1722,6 +1728,7 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,
 		goto failed_0;
 	}
 
+	tx->tx_gpu = !!(payload_md->md_flags & LNET_MD_FLAG_GPU);
 	if (!nob)
 		rc = 0;
 	else
@@ -1784,7 +1791,7 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,
 	struct kib_tx *tx;
 	int nob;
 	int post_credit = IBLND_POSTRX_PEER_CREDIT;
-	u64 ibprm_cookie = rxmsg->ibm_u.putreq.ibprm_cookie;
+	u64 ibprm_cookie;
 	int rc = 0;
 
 	LASSERT(iov_iter_count(to) <= rlen);
@@ -1819,6 +1826,9 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,
 	case IBLND_MSG_PUT_REQ: {
 		struct kib_msg *txmsg;
 		struct kib_rdma_desc *rd;
+		struct lnet_libmd *payload_md = lntmsg->msg_md;
+
+		ibprm_cookie = rxmsg->ibm_u.putreq.ibprm_cookie;
 
 		if (!iov_iter_count(to)) {
 			lnet_finalize(lntmsg, 0);
@@ -1836,6 +1846,7 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,
 			break;
 		}
 
+		tx->tx_gpu = !!(payload_md->md_flags & LNET_MD_FLAG_GPU);
 		txmsg = tx->tx_msg;
 		rd = &txmsg->ibm_u.putack.ibpam_rd;
 		rc = kiblnd_setup_rd_kiov(ni, tx, rd,
net/lnet/lnet/lib-md.c +3 -0
index affa921..05fb666 100644
@@ -192,6 +192,9 @@ struct page *
 	lmd->md_flags = (unlink == LNET_UNLINK) ? LNET_MD_FLAG_AUTO_UNLINK : 0;
 	lmd->md_bulk_handle = umd->bulk_handle;
 
+	if (umd->options & LNET_MD_GPU_ADDR)
+		lmd->md_flags |= LNET_MD_FLAG_GPU;
+
 	if (umd->options & LNET_MD_KIOV) {
 		niov = umd->length;
 		lmd->md_niov = umd->length;
net/lnet/lnet/lib-move.c +6 -4
index 0c5bf82..53e953f 100644
@@ -1450,11 +1450,13 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,
 	u32 best_sel_prio;
 	unsigned int best_dev_prio;
 	unsigned int dev_idx = UINT_MAX;
-	struct page *page = lnet_get_first_page(md, offset);
+	bool gpu = md ? (md->md_flags & LNET_MD_FLAG_GPU) : false;
+
+	if (gpu) {
+		struct page *page = lnet_get_first_page(md, offset);
 
-	msg->msg_rdma_force = lnet_is_rdma_only_page(page);
-	if (msg->msg_rdma_force)
 		dev_idx = lnet_get_dev_idx(page);
+	}
 
 	/* If there is no peer_ni that we can send to on this network,
 	 * then there is no point in looking for a new best_ni here.
@@ -1505,7 +1507,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,
 		 * All distances smaller than the NUMA range
 		 * are treated equally.
 		 */
-		if (distance < lnet_numa_range)
+		if (!gpu && distance < lnet_numa_range)
 			distance = lnet_numa_range;
 
 		/* * Select on health, selection policy, direct dma prio,
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#11 lore raw

PATCH 11/32 lustre: som: disabling xattr cache for LSOM on client

In reply to James Simmons

From: Qian Yingjin <[email protected]>

To obtain uptodate LSOM data, currently a client needs to set llite.*.xattr_cache =0 to disable the xattr cache on client completely. This leads that other kinds of xattr can not be cached on the client too.
This patch introduces a heavy-weight solution to disable caching only for LSOM xattr data ("trusted.som") on client.

WC-bug-id: https://jira.whamcloud.com/browse/LU-11695
Lustre-commit: 192902851d73ec246 ("LU-11695 som: disabling xattr cache for LSOM on client")

Reviewed-on: https://review.whamcloud.com/33711

---
 fs/lustre/llite/xattr.c       | 3 ++-
 fs/lustre/llite/xattr_cache.c | 4 ++++
 2 files changed, 6 insertions(+), 1 deletion(-)
fs/lustre/llite/xattr.c +2 -1
index 3a342ad..11310f9 100644
@@ -373,7 +373,8 @@ int ll_xattr_list(struct inode *inode, const char *name, int type, void *buffer,
 	}
 
 	if (sbi->ll_xattr_cache_enabled && type != XATTR_ACL_ACCESS_T &&
-	    (type != XATTR_SECURITY_T || strcmp(name, "security.selinux"))) {
+	    (type != XATTR_SECURITY_T || strcmp(name, "security.selinux")) &&
+	    (type != XATTR_TRUSTED_T || strcmp(name, XATTR_NAME_SOM))) {
 		rc = ll_xattr_cache_get(inode, name, buffer, size, valid);
 		if (rc == -EAGAIN)
 			goto getxattr_nocache;
fs/lustre/llite/xattr_cache.c +4 -0
index 723cc39..7e5b807 100644
@@ -465,6 +465,10 @@ static int ll_xattr_cache_refill(struct inode *inode)
 			/* Filter out security.selinux, it is cached in slab */
 			CDEBUG(D_CACHE, "not caching security.selinux\n");
 			rc = 0;
+		} else if (!strcmp(xdata, XATTR_NAME_SOM)) {
+			/* Filter out trusted.som, it is not cached on client */
+			CDEBUG(D_CACHE, "not caching trusted.som\n");
+			rc = 0;
 		} else {
 			rc = ll_xattr_cache_add(&lli->lli_xattrs, xdata, xval,
 						*xsizes);
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#12 lore raw

PATCH 12/32 lnet: discard some peer_ni lookup functions

In reply to James Simmons

From: Mr NeilBrown <[email protected]>

lnet_nid2peerni_locked(), lnet_peer_get_ni_locked(), lnet_find_peer4(), and lnet_find_peer_ni_locked() each have few users left and that can call be change to use alternate versions which take 'struct lnet_nid' rather than 'lnet_nid_t'.

So convert all those callers over, and discard the older functions.

WC-bug-id: https://jira.whamcloud.com/browse/LU-10391
Lustre-commit: 9768d8929a305588f ("LU-10391 lnet: discard some peer_ni lookup functions")

Reviewed-on: https://review.whamcloud.com/44624

---
 include/linux/lnet/lib-lnet.h |   6 --
 net/lnet/lnet/api-ni.c        |  26 +++---
 net/lnet/lnet/lib-move.c      |   8 +-
 net/lnet/lnet/peer.c          | 211 +++++++++++++++---------------------------
 net/lnet/lnet/router.c        |  18 ++--
 net/lnet/lnet/udsp.c          |   8 +-
 6 files changed, 110 insertions(+), 167 deletions(-)
include/linux/lnet/lib-lnet.h +0 -6
index e21866b..3bdb49e 100644
@@ -898,19 +898,13 @@ struct lnet_peer_net *lnet_get_next_peer_net_locked(struct lnet_peer *lp,
 struct lnet_peer_ni *lnet_get_next_peer_ni_locked(struct lnet_peer *peer,
 						  struct lnet_peer_net *peer_net,
 						  struct lnet_peer_ni *prev);
-struct lnet_peer_ni *lnet_nid2peerni_locked(lnet_nid_t nid, lnet_nid_t pref,
-					    int cpt);
 struct lnet_peer_ni *lnet_peerni_by_nid_locked(struct lnet_nid *nid,
 					       struct lnet_nid *pref,
 					       int cpt);
 struct lnet_peer_ni *lnet_nid2peerni_ex(struct lnet_nid *nid);
-struct lnet_peer_ni *lnet_peer_get_ni_locked(struct lnet_peer *lp,
-					     lnet_nid_t nid);
 struct lnet_peer_ni *lnet_peer_ni_get_locked(struct lnet_peer *lp,
 					     struct lnet_nid *nid);
-struct lnet_peer_ni *lnet_find_peer_ni_locked(lnet_nid_t nid);
 struct lnet_peer_ni *lnet_peer_ni_find_locked(struct lnet_nid *nid);
-struct lnet_peer *lnet_find_peer4(lnet_nid_t nid);
 struct lnet_peer *lnet_find_peer(struct lnet_nid *nid);
 void lnet_peer_net_added(struct lnet_net *net);
 void lnet_peer_primary_nid_locked(struct lnet_nid *nid,
net/lnet/lnet/api-ni.c +15 -11
index 165728d..124ec86 100644
@@ -4381,7 +4381,8 @@ u32 lnet_get_dlc_seq_locked(void)
 			return rc;
 
 		mutex_lock(&the_lnet.ln_api_mutex);
-		lp = lnet_find_peer4(ping->ping_id.nid);
+		lnet_nid4_to_nid(ping->ping_id.nid, &nid);
+		lp = lnet_find_peer(&nid);
 		if (lp) {
 			ping->ping_id.nid =
 				lnet_nid_to_nid4(&lp->lp_primary_nid);
@@ -4405,7 +4406,8 @@ u32 lnet_get_dlc_seq_locked(void)
 			return rc;
 
 		mutex_lock(&the_lnet.ln_api_mutex);
-		lp = lnet_find_peer4(discover->ping_id.nid);
+		lnet_nid4_to_nid(discover->ping_id.nid, &nid);
+		lp = lnet_find_peer(&nid);
 		if (lp) {
 			discover->ping_id.nid =
 				lnet_nid_to_nid4(&lp->lp_primary_nid);
@@ -4687,7 +4689,7 @@ static int lnet_ping(struct lnet_process_id id4, struct lnet_nid *src_nid,
 
 	if (nob < 8) {
 		CERROR("%s: ping info too short %d\n",
-		       libcfs_id2str(id4), nob);
+		       libcfs_idstr(&id), nob);
 		goto fail_ping_buffer_decref;
 	}
 
@@ -4695,19 +4697,19 @@ static int lnet_ping(struct lnet_process_id id4, struct lnet_nid *src_nid,
 		lnet_swap_pinginfo(pbuf);
 	} else if (pbuf->pb_info.pi_magic != LNET_PROTO_PING_MAGIC) {
 		CERROR("%s: Unexpected magic %08x\n",
-		       libcfs_id2str(id4), pbuf->pb_info.pi_magic);
+		       libcfs_idstr(&id), pbuf->pb_info.pi_magic);
 		goto fail_ping_buffer_decref;
 	}
 
 	if (!(pbuf->pb_info.pi_features & LNET_PING_FEAT_NI_STATUS)) {
 		CERROR("%s: ping w/o NI status: 0x%x\n",
-		       libcfs_id2str(id4), pbuf->pb_info.pi_features);
+		       libcfs_idstr(&id), pbuf->pb_info.pi_features);
 		goto fail_ping_buffer_decref;
 	}
 
 	if (nob < LNET_PING_INFO_SIZE(0)) {
 		CERROR("%s: Short reply %d(%d min)\n",
-		       libcfs_id2str(id4),
+		       libcfs_idstr(&id),
 		       nob, (int)LNET_PING_INFO_SIZE(0));
 		goto fail_ping_buffer_decref;
 	}
@@ -4717,7 +4719,7 @@ static int lnet_ping(struct lnet_process_id id4, struct lnet_nid *src_nid,
 
 	if (nob < LNET_PING_INFO_SIZE(n_ids)) {
 		CERROR("%s: Short reply %d(%d expected)\n",
-		       libcfs_id2str(id4),
+		       libcfs_idstr(&id),
 		       nob, (int)LNET_PING_INFO_SIZE(n_ids));
 		goto fail_ping_buffer_decref;
 	}
@@ -4739,7 +4741,7 @@ static int lnet_ping(struct lnet_process_id id4, struct lnet_nid *src_nid,
 }
 
 static int
-lnet_discover(struct lnet_process_id id, u32 force,
+lnet_discover(struct lnet_process_id id4, u32 force,
 	      struct lnet_process_id __user *ids,
 	      int n_ids)
 {
@@ -4747,14 +4749,16 @@ static int lnet_ping(struct lnet_process_id id4, struct lnet_nid *src_nid,
 	struct lnet_peer_ni *p;
 	struct lnet_peer *lp;
 	struct lnet_process_id *buf;
+	struct lnet_processid id;
 	int cpt;
 	int i;
 	int rc;
 
 	if (n_ids <= 0 ||
-	    id.nid == LNET_NID_ANY)
+	    id4.nid == LNET_NID_ANY)
 		return -EINVAL;
 
+	lnet_pid4_to_pid(id4, &id);
 	if (id.pid == LNET_PID_ANY)
 		id.pid = LNET_PID_LUSTRE;
 
@@ -4769,7 +4773,7 @@ static int lnet_ping(struct lnet_process_id id4, struct lnet_nid *src_nid,
 		return -ENOMEM;
 
 	cpt = lnet_net_lock_current();
-	lpni = lnet_nid2peerni_locked(id.nid, LNET_NID_ANY, cpt);
+	lpni = lnet_peerni_by_nid_locked(&id.nid, NULL, cpt);
 	if (IS_ERR(lpni)) {
 		rc = PTR_ERR(lpni);
 		goto out;
@@ -4795,7 +4799,7 @@ static int lnet_ping(struct lnet_process_id id4, struct lnet_nid *src_nid,
 	 * and lookup the lpni again
 	 */
 	lnet_peer_ni_decref_locked(lpni);
-	lpni = lnet_find_peer_ni_locked(id.nid);
+	lpni = lnet_peer_ni_find_locked(&id.nid);
 	if (!lpni) {
 		rc = -ENOENT;
 		goto out;
net/lnet/lnet/lib-move.c +4 -4
index 53e953f..a514472 100644
@@ -1907,7 +1907,7 @@ struct lnet_ni *
 		return rc;
 	}
 
-	new_lpni = lnet_find_peer_ni_locked(lnet_nid_to_nid4(&lpni->lpni_nid));
+	new_lpni = lnet_peer_ni_find_locked(&lpni->lpni_nid);
 	if (!new_lpni) {
 		lnet_peer_ni_decref_locked(lpni);
 		return -ENOENT;
@@ -2795,7 +2795,7 @@ struct lnet_ni *
 		 * try to send it via non-multi-rail criteria
 		 */
 		if (!IS_ERR(src_lpni)) {
-			/* Drop ref taken by lnet_nid2peerni_locked() */
+			/* Drop ref taken by lnet_peerni_by_nid_locked() */
 			lnet_peer_ni_decref_locked(src_lpni);
 			src_lp = lpni->lpni_peer_net->lpn_peer;
 			if (lnet_peer_is_multi_rail(src_lp) &&
@@ -3523,7 +3523,7 @@ struct lnet_mt_event_info {
 					    ev_info, the_lnet.ln_mt_handler,
 					    true);
 			lnet_net_lock(0);
-			/* lnet_find_peer_ni_locked() grabs a refcount for
+			/* lnet_peer_ni_find_locked() grabs a refcount for
 			 * us. No need to take it explicitly.
 			 */
 			lpni = lnet_peer_ni_find_locked(&nid);
@@ -3546,7 +3546,7 @@ struct lnet_mt_event_info {
 				spin_unlock(&lpni->lpni_lock);
 			}
 
-			/* Drop the ref taken by lnet_find_peer_ni_locked() */
+			/* Drop the ref taken by lnet_peer_ni_find_locked() */
 			lnet_peer_ni_decref_locked(lpni);
 			lnet_net_unlock(0);
 		} else {
net/lnet/lnet/peer.c +77 -134

523 lines not on this page · raw message

net/lnet/lnet/router.c +9 -9
index b4f7aaa..bbef2b3 100644
@@ -1199,8 +1199,7 @@ bool lnet_router_checker_active(void)
 		spin_unlock(&rtr->lp_lock);
 
 		/* find the peer_ni associated with the primary NID */
-		lpni = lnet_peer_get_ni_locked(rtr,
-					       lnet_nid_to_nid4(&rtr->lp_primary_nid));
+		lpni = lnet_peer_ni_get_locked(rtr, &rtr->lp_primary_nid);
 		if (!lpni) {
 			CDEBUG(D_NET,
 			       "Expected to find an lpni for %s, but non found\n",
@@ -1701,25 +1700,26 @@ bool lnet_router_checker_active(void)
  * when: notificaiton time.
  */
 int
-lnet_notify(struct lnet_ni *ni, lnet_nid_t nid, bool alive, bool reset,
+lnet_notify(struct lnet_ni *ni, lnet_nid_t nid4, bool alive, bool reset,
 	    time64_t when)
 {
 	struct lnet_peer_ni *lpni = NULL;
 	struct lnet_route *route;
 	struct lnet_peer *lp;
 	time64_t now = ktime_get_seconds();
+	struct lnet_nid nid;
 	int cpt;
 
 	LASSERT(!in_interrupt());
 
 	CDEBUG(D_NET, "%s notifying %s: %s\n",
 	       !ni ? "userspace" : libcfs_nidstr(&ni->ni_nid),
-	       libcfs_nid2str(nid), alive ? "up" : "down");
+	       libcfs_nidstr(&nid), alive ? "up" : "down");
 
 	if (ni &&
-	    LNET_NID_NET(&ni->ni_nid) != LNET_NIDNET(nid)) {
+	    LNET_NID_NET(&ni->ni_nid) != LNET_NID_NET(&nid)) {
 		CWARN("Ignoring notification of %s %s by %s (different net)\n",
-		      libcfs_nid2str(nid), alive ? "birth" : "death",
+		      libcfs_nidstr(&nid), alive ? "birth" : "death",
 		      libcfs_nidstr(&ni->ni_nid));
 		return -EINVAL;
 	}
@@ -1728,7 +1728,7 @@ bool lnet_router_checker_active(void)
 	if (when > now) {
 		CWARN("Ignoring prediction from %s of %s %s %lld seconds in the future\n",
 		      ni ? libcfs_nidstr(&ni->ni_nid) : "userspace",
-		      libcfs_nid2str(nid), alive ? "up" : "down", when - now);
+		      libcfs_nidstr(&nid), alive ? "up" : "down", when - now);
 		return -EINVAL;
 	}
 
@@ -1746,11 +1746,11 @@ bool lnet_router_checker_active(void)
 		return -ESHUTDOWN;
 	}
 
-	lpni = lnet_find_peer_ni_locked(nid);
+	lpni = lnet_peer_ni_find_locked(&nid);
 	if (!lpni) {
 		/* nid not found */
 		lnet_net_unlock(0);
-		CDEBUG(D_NET, "%s not found\n", libcfs_nid2str(nid));
+		CDEBUG(D_NET, "%s not found\n", libcfs_nidstr(&nid));
 		return 0;
 	}
 
net/lnet/lnet/udsp.c +5 -3
index 7fa4f88..2594df1 100644
@@ -1052,17 +1052,19 @@ struct lnet_udsp *
 {
 	struct lnet_ni *ni;
 	struct lnet_peer_ni *lpni;
+	struct lnet_nid nid;
 
 	lnet_net_lock(0);
+	lnet_nid4_to_nid(info->cud_nid, &nid);
 	if (!info->cud_peer) {
-		ni = lnet_nid2ni_locked(info->cud_nid, 0);
+		ni = lnet_nid_to_ni_locked(&nid, 0);
 		if (ni)
 			lnet_udsp_get_ni_info(info, ni);
 	} else {
-		lpni = lnet_find_peer_ni_locked(info->cud_nid);
+		lpni = lnet_peer_ni_find_locked(&nid);
 		if (!lpni) {
 			CDEBUG(D_NET, "nid %s is not found\n",
-			       libcfs_nid2str(info->cud_nid));
+			       libcfs_nidstr(&nid));
 		} else {
 			lnet_udsp_get_peer_info(info, lpni);
 			lnet_peer_ni_decref_locked(lpni);
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#13 lore raw

PATCH 13/32 lnet: change lnet_*_peer_ni to take struct lnet_nid

In reply to James Simmons

From: Mr NeilBrown <[email protected]>

lnet_add_peer_ni() and lnet_del_peer_ni() now take struct lnet_nid rather than lnet_nid_t.

WC-bug-id: https://jira.whamcloud.com/browse/LU-10391
Lustre-commit: d9af9b5a7ee706660 ("LU-10391 lnet: change lnet_*_peer_ni to take struct lnet_nid")

Reviewed-on: https://review.whamcloud.com/44625

---
 include/linux/lnet/lib-lnet.h |  5 +--
 net/lnet/lnet/api-ni.c        | 14 +++++---
 net/lnet/lnet/peer.c          | 74 +++++++++++++++++++++----------------------
 3 files changed, 49 insertions(+), 44 deletions(-)
include/linux/lnet/lib-lnet.h +3 -2
index 3bdb49e..5a83190 100644
@@ -930,8 +930,9 @@ bool lnet_peer_is_pref_rtr_locked(struct lnet_peer_ni *lpni,
 int lnet_peer_add_pref_rtr(struct lnet_peer_ni *lpni, struct lnet_nid *nid);
 int lnet_peer_ni_set_non_mr_pref_nid(struct lnet_peer_ni *lpni,
 				     struct lnet_nid *nid);
-int lnet_add_peer_ni(lnet_nid_t key_nid, lnet_nid_t nid, bool mr, bool temp);
-int lnet_del_peer_ni(lnet_nid_t key_nid, lnet_nid_t nid);
+int lnet_add_peer_ni(struct lnet_nid *key_nid, struct lnet_nid *nid, bool mr,
+		     bool temp);
+int lnet_del_peer_ni(struct lnet_nid *key_nid, struct lnet_nid *nid);
 int lnet_get_peer_info(struct lnet_ioctl_peer_cfg *cfg, void __user *bulk);
 int lnet_get_peer_ni_info(u32 peer_index, u64 *nid,
 			  char alivness[LNET_MAX_STR_LEN],
net/lnet/lnet/api-ni.c +9 -5
index 124ec86..7c94d16 100644
@@ -4176,27 +4176,31 @@ u32 lnet_get_dlc_seq_locked(void)
 
 	case IOC_LIBCFS_ADD_PEER_NI: {
 		struct lnet_ioctl_peer_cfg *cfg = arg;
+		struct lnet_nid prim_nid;
 
 		if (cfg->prcfg_hdr.ioc_len < sizeof(*cfg))
 			return -EINVAL;
 
 		mutex_lock(&the_lnet.ln_api_mutex);
-		rc = lnet_add_peer_ni(cfg->prcfg_prim_nid,
-				      cfg->prcfg_cfg_nid,
-				      cfg->prcfg_mr, false);
+		lnet_nid4_to_nid(cfg->prcfg_prim_nid, &prim_nid);
+		lnet_nid4_to_nid(cfg->prcfg_cfg_nid, &nid);
+		rc = lnet_add_peer_ni(&prim_nid, &nid, cfg->prcfg_mr, false);
 		mutex_unlock(&the_lnet.ln_api_mutex);
 		return rc;
 	}
 
 	case IOC_LIBCFS_DEL_PEER_NI: {
 		struct lnet_ioctl_peer_cfg *cfg = arg;
+		struct lnet_nid prim_nid;
 
 		if (cfg->prcfg_hdr.ioc_len < sizeof(*cfg))
 			return -EINVAL;
 
 		mutex_lock(&the_lnet.ln_api_mutex);
-		rc = lnet_del_peer_ni(cfg->prcfg_prim_nid,
-				      cfg->prcfg_cfg_nid);
+		lnet_nid4_to_nid(cfg->prcfg_prim_nid, &prim_nid);
+		lnet_nid4_to_nid(cfg->prcfg_cfg_nid, &nid);
+		rc = lnet_del_peer_ni(&prim_nid,
+				      &nid);
 		mutex_unlock(&the_lnet.ln_api_mutex);
 		return rc;
 	}
net/lnet/lnet/peer.c +37 -37

206 lines not on this page · raw message

Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#14 lore raw

PATCH 14/32 lnet: Ensure round robin across nets

In reply to James Simmons

From: Chris Horn <[email protected]>

Introduce a global net sequence number and a peer sequence number. These sequence numbers are used to ensure round robin selection of local NIs and peer NIs across nets.

Also consolidate the sequence number accounting under lnet_handle_send(). Previously the sequence number increment for the final destination peer net/peer NI on a routed send was done in lnet_handle_find_routed_path().

Some cleanup that is also in this patch:
- Redundant check of null src_nid is removed from lnet_handle_find_routed_path() (LNET_NID_IS_ANY handles null arg)
- Avoid comparing best_lpn with itself in lnet_handle_find_routed_path() on the first loop iteration
- In lnet_find_best_ni_on_local_net() check whether we have a specified lp_disc_net_id outside of the loop to avoid doing that work on each loop iteration.

Added some debug statements to print information used when selecting peer net/local net.

HPE-bug-id: LUS-10871
WC-bug-id: https://jira.whamcloud.com/browse/LU-15713
Lustre-commit: 05413b3d84f7d1feb ("LU-15713 lnet: Ensure round robin across nets")

Reviewed-on: https://review.whamcloud.com/46976

---
 include/linux/lnet/lib-types.h | 11 ++++-
 net/lnet/lnet/lib-move.c       | 96 +++++++++++++++++++++++++++---------------
 2 files changed, 72 insertions(+), 35 deletions(-)
include/linux/lnet/lib-types.h +9 -2
index 1827f4e..09b9d8e 100644
@@ -765,6 +765,11 @@ struct lnet_peer {
 
 	/* cached peer aliveness */
 	bool			lp_alive;
+
+	/* sequence number used to round robin traffic to this peer's
+	 * nets/NIs
+	 */
+	u32			lp_send_seq;
 };
 
 /*
@@ -1205,10 +1210,12 @@ struct lnet {
 
 	/* LND instances */
 	struct list_head		ln_nets;
-	/* network zombie list */
-	struct list_head		ln_net_zombie;
+	/* Sequence number used to round robin sends across all nets */
+	u32				ln_net_seq;
 	/* the loopback NI */
 	struct lnet_ni		       *ln_loni;
+	/* network zombie list */
+	struct list_head		ln_net_zombie;
 	/* resend messages list */
 	struct list_head		ln_msg_resend;
 	/* spin lock to protect the msg resend list */
net/lnet/lnet/lib-move.c +63 -33

181 lines not on this page · raw message

Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#15 lore raw

PATCH 15/32 lustre: llite: dont restart directIO with IOCB_NOWAIT

In reply to James Simmons

From: Qian Yingjin <[email protected]>

It should handle FLR mirror retry and io_uring with IOCB_NOWAIT flag differently.

int cl_io_loop(const struct lu_env *env, struct cl_io *io)

{
    ...
    if (result == -EAGAIN && io->ci_ndelay) {
        io->ci_need_restart = 1;
        result = 0;
    }
    ...
}

ssize_t
generic_file_read_iter(struct kiocb *iocb, struct iov_iter *iter)

{
    ...
    if (iocb->ki_flags & IOCB_NOWAIT) {
        if (filemap_range_has_page(mapping, iocb->ki_pos,
                                   iocb->ki_pos +
                                   count - 1))
                return -EAGAIN;
    ...
    }

In current code, it will restart I/O engine for read when get -EAGAIN code.
However, for io_uring direct IO with IOCB_NOWAIT, if found that there are cache pages in the current I/O range, it should return -EAGAIN to the upper layer immediately. Otherwise, it will stuck in an endless loop.

This patch also adds a tool "io_uring_probe" to check whether the kernel supports io_uring fully.
The reason adding this check is because the rhel8.5 kernel has backported io_uring:
cat /proc/kallsyms |grep io_uring
ffffffffa8510e10 W __x64_sys_io_uring_enter ffffffffa8510e10 W __x64_sys_io_uring_register ffffffffa8510e10 W __x64_sys_io_uring_setup
but the io_uring syscalls return -ENOSYS.

WC-bug-id: https://jira.whamcloud.com/browse/LU-15399
Lustre-commit: 8db455c77265063a1 ("LU-15399 llite: dont restart directIO with IOCB_NOWAIT")

Reviewed-on: https://review.whamcloud.com/46147

---
 fs/lustre/include/cl_object.h | 6 +++++-
 fs/lustre/llite/file.c        | 6 ++++++
 fs/lustre/obdclass/cl_io.c    | 2 +-
 3 files changed, 12 insertions(+), 2 deletions(-)
fs/lustre/include/cl_object.h +5 -1
index c66e98c5..c717d03 100644
@@ -1960,7 +1960,11 @@ struct cl_io {
 	/**
 	 * Bypass quota check
 	 */
-	unsigned int		ci_noquota:1;
+	unsigned int		ci_noquota:1,
+	/**
+	 * io_uring direct IO with flags IOCB_NOWAIT.
+	 */
+				ci_iocb_nowait:1;
 	/**
 	 * How many times the read has retried before this one.
 	 * Set by the top level and consumed by the LOV.
fs/lustre/llite/file.c +6 -0
index 0e71b3a..3aace07 100644
@@ -1587,6 +1587,12 @@ void ll_io_init(struct cl_io *io, const struct file *file, int write,
 					   IOCB_DSYNC));
 	}
 
+#ifdef IOCB_NOWAIT
+	io->ci_iocb_nowait = !!(args &&
+				(args->u.normal.via_iocb->ki_flags &
+				 IOCB_NOWAIT));
+#endif
+
 	io->ci_obj = ll_i2info(inode)->lli_clob;
 	io->ci_lockreq = CILR_MAYBE;
 	if (ll_file_nolock(file)) {
fs/lustre/obdclass/cl_io.c +1 -1
index 4246e17..c388700 100644
@@ -776,7 +776,7 @@ int cl_io_loop(const struct lu_env *env, struct cl_io *io)
 	if (rc && !result)
 		result = rc;
 
-	if (result == -EAGAIN && io->ci_ndelay) {
+	if (result == -EAGAIN && io->ci_ndelay && !io->ci_iocb_nowait) {
 		io->ci_need_restart = 1;
 		result = 0;
 	}
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#16 lore raw

PATCH 16/32 lustre: sec: handle read-only flag

In reply to James Simmons

From: Sebastien Buisson <[email protected]>

Add a new 'readonly_mount' property to nodemaps on the server side. When this property is set, we return -EROFS from server side if the client is not mounting read-only. So the client will have to specify the read-only mount option to be allowed to mount.

WC-bug-id: https://jira.whamcloud.com/browse/LU-15451
Lustre-commit: e7ce67de92dea6870 ("LU-15451 sec: read-only nodemap flag")

Reviewed-on: https://review.whamcloud.com/46149

---
 fs/lustre/ptlrpc/import.c | 4 ++--
 fs/lustre/ptlrpc/niobuf.c | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)
fs/lustre/ptlrpc/import.c +2 -2
index a5fdb8a8..697b3c3 100644
@@ -1306,10 +1306,10 @@ static int ptlrpc_connect_interpret(const struct lu_env *env,
 		time64_t next_connect;
 
 		import_set_state_nolock(imp, LUSTRE_IMP_DISCON);
-		if (rc == -EACCES) {
+		if (rc == -EACCES || rc == -EROFS) {
 			/*
 			 * Give up trying to reconnect
-			 * EACCES means client has no permission for connection
+			 * EROFS means client must mount read-only
 			 */
 			imp->imp_obd->obd_no_recov = 1;
 			ptlrpc_deactivate_import_nolock(imp);
fs/lustre/ptlrpc/niobuf.c +2 -1
index 94a0329..be1811a 100644
@@ -472,7 +472,8 @@ int ptlrpc_send_error(struct ptlrpc_request *req, int may_be_difficult)
 
 	if (req->rq_status != -ENOSPC && req->rq_status != -EACCES &&
 	    req->rq_status != -EPERM && req->rq_status != -ENOENT &&
-	    req->rq_status != -EINPROGRESS && req->rq_status != -EDQUOT)
+	    req->rq_status != -EINPROGRESS && req->rq_status != -EDQUOT &&
+	    req->rq_status != -EROFS)
 		req->rq_type = PTL_RPC_MSG_ERR;
 
 	rc = ptlrpc_send_reply(req, may_be_difficult);
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#17 lore raw

PATCH 17/32 lustre: llog: Add LLOG_SKIP_PLAIN to skip llog plain

In reply to James Simmons

From: Etienne AUJAMES <[email protected]>

Add the catalog callback return LLOG_SKIP_PLAIN to conditionally skip an entire llog plain.

This could speedup the catalog processing for specific usages when a record need to be access in the "middle" of the catalog. This could be useful for changelog with several users or HSM.

This patch modify chlg_read_cat_process_cb() to use LLOG_SKIP_PLAIN. The main idea came from: d813c75d ("LU-14688 mdt: changelog purge deletes plain llog")

**Performance test:**

* Environment:
2474195 changelogs record store on the mds0 (40 llog plain):
mds# lctl get_param -n mdd.lustrefs-MDT0000.changelog_users current index: 2474195
ID index (idle seconds)
cl1 0 (3509)

* Test
Access to records at the end of the catalog (offset: 2474194):
client# time lfs changelog lustrefs-MDT0000 2474194 >/dev/null

* Results

- with the patch:       real    0m0.592s
- without the patch:    real    0m17.835s (x30)

WC-bug-id: https://jira.whamcloud.com/browse/LU-15481
Lustre-commit: aa22a6826ee521ab1 ("LU-15481 llog: Add LLOG_SKIP_PLAIN to skip llog plain")

Reviewed-on: https://review.whamcloud.com/46310

---
 fs/lustre/include/lustre_log.h | 18 +++++++++++++++++-
 fs/lustre/mdc/mdc_changelog.c  |  5 +++++
 2 files changed, 22 insertions(+), 1 deletion(-)
fs/lustre/include/lustre_log.h +17 -1
index 2e43d56..dbf3fd6 100644
@@ -264,7 +264,7 @@ struct llog_ctxt {
 };
 
 #define LLOG_PROC_BREAK 0x0001
-#define LLOG_DEL_RECORD 0x0002
+#define LLOG_SKIP_PLAIN 0x0004
 
 static inline int llog_handle2ops(struct llog_handle *loghandle,
 				  const struct llog_operations **lop)
@@ -375,6 +375,22 @@ static inline int llog_next_block(const struct lu_env *env,
 	return rc;
 }
 
+/* Determine if a llog plain of a catalog could be skiped based on record
+ * custom indexes.
+ * This assumes that indexes follow each other. The number of records to skip
+ * can be computed base on a starting offset and the index of the current
+ * record (in llog catalog callback).
+ */
+static inline int llog_is_plain_skipable(struct llog_log_hdr *lh,
+					 struct llog_rec_hdr *rec,
+					 u64 curr, u64 start)
+{
+	if (start == 0 || curr >= start)
+		return 0;
+
+	return (LLOG_HDR_BITMAP_SIZE(lh) - rec->lrh_index) < (start - curr);
+}
+
 /* llog.c */
 int lustre_process_log(struct super_block *sb, char *logname,
 		       struct config_llog_instance *cfg);
fs/lustre/mdc/mdc_changelog.c +5 -0
index 36d7fdd..cd2a610 100644
@@ -225,6 +225,11 @@ static int chlg_read_cat_process_cb(const struct lu_env *env,
 		return rc;
 	}
 
+	/* Check if we can skip the entire llog plain */
+	if (llog_is_plain_skipable(llh->lgh_hdr, hdr, rec->cr.cr_index,
+				   crs->crs_start_offset))
+		return LLOG_SKIP_PLAIN;
+
 	/* Skip undesired records */
 	if (rec->cr.cr_index < crs->crs_start_offset)
 		return 0;
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#18 lore raw

PATCH 18/32 lustre: llite: add projid to debug logs

In reply to James Simmons

From: Andreas Dilger <[email protected]>

Add some minimal debugging on the client to log the projid when it is changed, along with the affected FID.

WC-bug-id: https://jira.whamcloud.com/browse/LU-13335
Lustre-commit: 6bceb0030d15b7009 ("LU-13335 ldiskfs: add projid to debug logs")

Reviewed-on: https://review.whamcloud.com/46369

---
 fs/lustre/llite/file.c | 2 ++
 1 file changed, 2 insertions(+)
fs/lustre/llite/file.c +2 -0
index 3aace07..ac20d05 100644
@@ -3417,6 +3417,8 @@ static int ll_set_project(struct inode *inode, u32 xflags, u32 projid)
 	unsigned int inode_flags;
 	int rc = 0;
 
+	CDEBUG(D_QUOTA, DFID" xflags=%x projid=%u\n",
+	       PFID(ll_inode2fid(inode)), xflags, projid);
 	rc = ll_ioctl_check_project(inode, xflags, projid);
 	if (rc)
 		return rc;
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#19 lore raw

PATCH 19/32 lnet: asym route inconsistency warning

In reply to James Simmons

From: Gian-Carlo DeFazio <[email protected]>

lnet_check_route_inconsistency() checks for inconsistency between the lr_hops and lr_single_hop values of a route.

A warning is currently emitted if the route is not single hop and the hop count is either 1 or LNET_UNDEFINED_HOPS.

To emit the warning, add the requirement that
avoid_asym_router_failure is enabled.

WC-bug-id: https://jira.whamcloud.com/browse/LU-14555
Lustre-commit: 6ab060e58e6b3f38b ("LU-14555 lnet: asym route inconsistency warning")

Reviewed-on: https://review.whamcloud.com/46918

---
 net/lnet/lnet/router.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/lnet/lnet/router.c +2 -1
index bbef2b3..b684243 100644
@@ -369,7 +369,8 @@ bool lnet_is_route_alive(struct lnet_route *route)
 lnet_check_route_inconsistency(struct lnet_route *route)
 {
 	if (!route->lr_single_hop &&
-	    (route->lr_hops == 1 || route->lr_hops == LNET_UNDEFINED_HOPS)) {
+	    (route->lr_hops == 1 || route->lr_hops == LNET_UNDEFINED_HOPS) &&
+	    avoid_asym_router_failure) {
 		CWARN("route %s->%s is detected to be multi-hop but hop count is set to %d\n",
 		      libcfs_net2str(route->lr_net),
 		      libcfs_nidstr(&route->lr_gateway->lp_primary_nid),
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#20 lore raw

PATCH 20/32 lnet: libcfs: debugfs file_operation should have an owner

In reply to James Simmons

From: Mr NeilBrown <[email protected]>

If debugfs a file is open when unloading the libcfs/lnet module, it produces a kernel Oops (debugfs file_operations callbacks no longer exist).

Crash generated with routerstat (/sys/kernel/debug/lnet/stats):

[ 1449.750396] IP: [<ffffffffab24e093>] SyS_lseek+0x83/0x100
[ 1449.750412] PGD 9fa14067 PUD 9fa16067 PMD d4e5d067 PTE 0
[ 1449.750428] Oops: 0000 [#1] SMP
[ 1449.750883]  [<ffffffffab7aaf92>] system_call_fastpath+0x25/0x2a
[ 1449.750897]  [<ffffffffab7aaed5>] ?

system_call_after_swapgs+0xa2/0x13a

This patch adds an owner to debugfs file_operation for libcfs and lnet_router entries (/sys/kernel/debug/lnet/*).

The following behavior is expected:

$ modprobe lustre
$ routerstat 10 > /dev/null &
$ lustre_rmmod
rmmod: ERROR: Module lnet is in use
Can't read statfile (ENODEV)
[1]+  Exit 1                  routerstat 10 > /dev/null
$ lustre_rmmod

Note that the allocated 'struct file_operations' cannot be freed until the module_exit() function is called, as files could still be open until then.

WC-bug-id: https://jira.whamcloud.com/browse/LU-15759
Lustre-commit: b2dfb4457f0f1e56f ("LU-15759 libcfs: debugfs file_operation should have an owner")

Reviewed-on: https://review.whamcloud.com/47335

---
 include/linux/libcfs/libcfs.h |  4 +++-
 include/linux/lnet/lib-lnet.h |  1 +
 net/lnet/libcfs/module.c      | 43 ++++++++++++++++++++++++++++++++++++-------
 net/lnet/lnet/module.c        |  1 +
 net/lnet/lnet/router_proc.c   | 10 +++++++++-
 5 files changed, 50 insertions(+), 9 deletions(-)
include/linux/libcfs/libcfs.h +3 -1
index b59ef9b..e29b007 100644
@@ -57,8 +57,10 @@ static inline int notifier_from_ioctl_errno(int err)
 
 extern struct workqueue_struct *cfs_rehash_wq;
 
-void lnet_insert_debugfs(struct ctl_table *table);
+void lnet_insert_debugfs(struct ctl_table *table, struct module *mod,
+			 void **statep);
 void lnet_remove_debugfs(struct ctl_table *table);
+void lnet_debugfs_fini(void **statep);
 
 int debugfs_doint(struct ctl_table *table, int write,
 		  void __user *buffer, size_t *lenp, loff_t *ppos);
include/linux/lnet/lib-lnet.h +1 -0
index 5a83190..57c8dc2 100644
@@ -569,6 +569,7 @@ unsigned int lnet_nid_cpt_hash(struct lnet_nid *nid,
 
 int lnet_lib_init(void);
 void lnet_lib_exit(void);
+void lnet_router_exit(void);
 
 void lnet_mt_event_handler(struct lnet_event *event);
 
net/lnet/libcfs/module.c +36 -7

90 lines not on this page · raw message

net/lnet/lnet/module.c +1 -0
index aba9589..9d7b39a 100644
@@ -271,6 +271,7 @@ static void __exit lnet_exit(void)
 						&lnet_ioctl_handler);
 	LASSERT(!rc);
 
+	lnet_router_exit();
 	lnet_lib_exit();
 }
 
net/lnet/lnet/router_proc.c +9 -1
index f231da1..689670a 100644
@@ -888,12 +888,20 @@ static int proc_lnet_portal_rotor(struct ctl_table *table, int write,
 	}
 };
 
+static void *debugfs_state;
+
 void lnet_router_debugfs_init(void)
 {
-	lnet_insert_debugfs(lnet_table);
+	lnet_insert_debugfs(lnet_table, THIS_MODULE,
+			    &debugfs_state);
 }
 
 void lnet_router_debugfs_fini(void)
 {
 	lnet_remove_debugfs(lnet_table);
 }
+
+void lnet_router_exit(void)
+{
+	lnet_debugfs_fini(&debugfs_state);
+}
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#21 lore raw

PATCH 21/32 lustre: client: able to cleanup devices manually

In reply to James Simmons

From: Mikhail Pershin <[email protected]>

Using 'lctl cleanup/detach' could be needed in situations with unclean umount. Meanwhile that doesn't work now for LMV and also could cause panic after all

Patch restores ability to cleanup/detach client devices manually.
- debugfs and lprocfs cleanup in lmv_precleanup() are moved lmv_cleanup() to be not cleared too early. This prevents hang on 'lctl cleanup' for LMV device
- test 172 is added in sanity. It skips device cleanup during normal umount, keeping device alive without client mount then manually cleanups/detaches them
- prevent negative lov_connections in lov_disconnect() and handle it gracefully
- remove obd_cleanup_client_import() in mdc_precleanup(), it is called already inside osc_precleanup_common()

WC-bug-id: https://jira.whamcloud.com/browse/LU-15653
Lustre-commit: 210803a2475862464 ("LU-15653 client: able to cleanup devices manually")

Reviewed-on: https://review.whamcloud.com/46859

---
 fs/lustre/include/obd_support.h |  1 +
 fs/lustre/llite/llite_lib.c     |  5 +++++
 fs/lustre/lmv/lmv_obd.c         | 14 ++++++--------
 fs/lustre/lov/lov_obd.c         |  8 +++++++-
 fs/lustre/mdc/mdc_request.c     |  7 +++----
 5 files changed, 22 insertions(+), 13 deletions(-)
fs/lustre/include/obd_support.h +1 -0
index b6c8a72..e25d4ed 100644
@@ -381,6 +381,7 @@
 #define OBD_FAIL_OBDCLASS_MODULE_LOAD			0x60a
 #define OBD_FAIL_OBD_ZERO_NLINK_RACE			0x60b
 #define OBD_FAIL_OBD_SETUP				0x60d
+#define OBD_FAIL_OBD_CLEANUP				0x60e
 
 #define OBD_FAIL_TGT_REPLY_NET				0x700
 #define OBD_FAIL_TGT_CONN_RACE				0x701
fs/lustre/llite/llite_lib.c +5 -0
index 5b80722..d947ede 100644
@@ -1377,10 +1377,15 @@ void ll_put_super(struct super_block *sb)
 		client_common_put_super(sb);
 	}
 
+	/* imitate failed cleanup */
+	if (OBD_FAIL_CHECK(OBD_FAIL_OBD_CLEANUP))
+		goto skip_cleanup;
+
 	next = 0;
 	while ((obd = class_devices_in_group(&sbi->ll_sb_uuid, &next)))
 		class_manual_cleanup(obd);
 
+skip_cleanup:
 	if (test_bit(LL_SBI_VERBOSE, sbi->ll_flags))
 		LCONSOLE_WARN("Unmounted %s\n", profilenm ? profilenm : "");
 
fs/lustre/lmv/lmv_obd.c +6 -8
index 3af7a53..8656d6b 100644
@@ -520,7 +520,6 @@ static int lmv_disconnect(struct obd_export *exp)
 	struct obd_device *obd = class_exp2obd(exp);
 	struct lmv_obd *lmv = &obd->u.lmv;
 	struct lmv_tgt_desc *tgt;
-	int rc;
 
 	lmv_foreach_connected_tgt(lmv, tgt)
 		lmv_disconnect_mdc(obd, tgt);
@@ -528,11 +527,8 @@ static int lmv_disconnect(struct obd_export *exp)
 	if (lmv->lmv_tgts_kobj)
 		kobject_put(lmv->lmv_tgts_kobj);
 
-	if (!lmv->connected)
-		class_export_put(exp);
-	rc = class_disconnect(exp);
 	lmv->connected = 0;
-	return rc;
+	return class_disconnect(exp);
 }
 
 static int lmv_fid2path(struct obd_export *exp, int len, void *karg,
@@ -1147,6 +1143,11 @@ static int lmv_cleanup(struct obd_device *obd)
 	struct lu_tgt_desc *tmp;
 
 	fld_client_fini(&lmv->lmv_fld);
+	fld_client_debugfs_fini(&lmv->lmv_fld);
+
+	lprocfs_obd_cleanup(obd);
+	ldebugfs_free_md_stats(obd);
+
 	lmv_foreach_tgt_safe(lmv, tgt, tmp)
 		lmv_del_target(lmv, tgt);
 	lu_tgt_descs_fini(&lmv->lmv_mdt_descs);
@@ -3063,9 +3064,6 @@ static int lmv_unlink(struct obd_export *exp, struct md_op_data *op_data,
 static int lmv_precleanup(struct obd_device *obd)
 {
 	libcfs_kkuc_group_rem(&obd->obd_uuid, 0, KUC_GRP_HSM);
-	fld_client_debugfs_fini(&obd->u.lmv.lmv_fld);
-	lprocfs_obd_cleanup(obd);
-	ldebugfs_free_md_stats(obd);
 	return 0;
 }
 
fs/lustre/lov/lov_obd.c +7 -1
index 61159fd..161226f 100644
@@ -313,8 +313,14 @@ static int lov_disconnect(struct obd_export *exp)
 		goto out;
 
 	/* Only disconnect the underlying layers on the final disconnect. */
+	if (lov->lov_connects == 0) {
+		CWARN("%s: was disconnected already #%d\n",
+		      obd->obd_name, lov->lov_connects);
+		return 0;
+	}
+
 	lov->lov_connects--;
-	if (lov->lov_connects != 0) {
+	if (lov->lov_connects > 0) {
 		/* why should there be more than 1 connect? */
 		CWARN("%s: unexpected disconnect #%d\n",
 		      obd->obd_name, lov->lov_connects);
fs/lustre/mdc/mdc_request.c +3 -4
index bb51878..c073da2 100644
@@ -2959,11 +2959,10 @@ static int mdc_precleanup(struct obd_device *obd)
 	osc_precleanup_common(obd);
 
 	mdc_changelog_cdev_finish(obd);
-
-	obd_cleanup_client_import(obd);
-	ptlrpc_lprocfs_unregister_obd(obd);
-	ldebugfs_free_md_stats(obd);
 	mdc_llog_finish(obd);
+	ldebugfs_free_md_stats(obd);
+	ptlrpc_lprocfs_unregister_obd(obd);
+
 	return 0;
 }
 
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#22 lore raw

PATCH 22/32 lustre: lmv: support striped LMVs

In reply to James Simmons

From: Lai Siyao <[email protected]>

lmv_name_to_stripe_index() should support stripe LMV, which is used by LFSCK to verify name hash.

WC-bug-id: https://jira.whamcloud.com/browse/LU-15868
Lustre-commit: 54a2d4662b58e2ba4 ("LU-15868 lfsck: don't crash upon dir migration failure")

Reviewed-on: https://review.whamcloud.com/47381

---
 fs/lustre/include/lustre_lmv.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
fs/lustre/include/lustre_lmv.h +4 -2
index b1d8ed9..cd7cf9e 100644
@@ -366,14 +366,16 @@ static inline u32 crush_hash(u32 a, u32 b)
 static inline int lmv_name_to_stripe_index(struct lmv_mds_md_v1 *lmv,
 					   const char *name, int namelen)
 {
-	if (lmv->lmv_magic == LMV_MAGIC_V1)
+	if (lmv->lmv_magic == LMV_MAGIC_V1 ||
+	    lmv->lmv_magic == LMV_MAGIC_STRIPE)
 		return __lmv_name_to_stripe_index(lmv->lmv_hash_type,
 						  lmv->lmv_stripe_count,
 						  lmv->lmv_migrate_hash,
 						  lmv->lmv_migrate_offset,
 						  name, namelen, true);
 
-	if (lmv->lmv_magic == cpu_to_le32(LMV_MAGIC_V1))
+	if (lmv->lmv_magic == cpu_to_le32(LMV_MAGIC_V1) ||
+	    lmv->lmv_magic == cpu_to_le32(LMV_MAGIC_STRIPE))
 		return __lmv_name_to_stripe_index(
 					le32_to_cpu(lmv->lmv_hash_type),
 					le32_to_cpu(lmv->lmv_stripe_count),
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#23 lore raw

PATCH 23/32 lnet: o2iblnd: add debug messages for IB

In reply to James Simmons

From: Cyril Bordage <[email protected]>

If net debug is enabled, information about connection, when tx status is ECONNABORTED, is collected (only for IB).

WC-bug-id: https://jira.whamcloud.com/browse/LU-15925
Lustre-commit: 9153049bdc7ec8217 ("LU-15925 lnet: add debug messages for IB")

Reviewed-on: https://review.whamcloud.com/47583

---
 net/lnet/klnds/o2iblnd/o2iblnd_cb.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
net/lnet/klnds/o2iblnd/o2iblnd_cb.c +16 -2
index 01fa499..d4d8954 100644
@@ -276,6 +276,13 @@ static int kiblnd_init_rdma(struct kib_conn *conn, struct kib_tx *tx, int type,
 
 	if (!tx->tx_status) {		/* success so far */
 		if (status < 0) {	/* failed? */
+			if (status == -ECONNABORTED) {
+				CDEBUG(D_NET,
+				       "bad status for connection to %s with completion type %x\n",
+				       libcfs_nid2str(conn->ibc_peer->ibp_nid),
+				       txtype);
+			}
+
 			tx->tx_status = status;
 			tx->tx_hstatus = LNET_MSG_STATUS_REMOTE_ERROR;
 		} else if (txtype == IBLND_MSG_GET_REQ) {
@@ -812,6 +819,8 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,
 
 	/* I'm still holding ibc_lock! */
 	if (conn->ibc_state != IBLND_CONN_ESTABLISHED) {
+		CDEBUG(D_NET, "connection to %s is not established\n",
+		       conn->ibc_peer ? libcfs_nid2str(conn->ibc_peer->ibp_nid) : "NULL");
 		rc = -ECONNABORTED;
 	} else if (tx->tx_pool->tpo_pool.po_failed ||
 		 conn->ibc_hdev != tx->tx_pool->tpo_hdev) {
@@ -1153,6 +1162,9 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,
 	LASSERT(conn->ibc_state >= IBLND_CONN_ESTABLISHED);
 
 	if (conn->ibc_state >= IBLND_CONN_DISCONNECTED) {
+		CDEBUG(D_NET, "connection with %s is disconnected\n",
+		       conn->ibc_peer ? libcfs_nid2str(conn->ibc_peer->ibp_nid) : "NULL");
+
 		tx->tx_status = -ECONNABORTED;
 		tx->tx_waiting = 0;
 		if (tx->tx_conn) {
@@ -2141,10 +2153,12 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,
 
 	kiblnd_set_conn_state(conn, IBLND_CONN_DISCONNECTED);
 
-	/*
-	 * Complete all tx descs not waiting for sends to complete.
+	/* Complete all tx descs not waiting for sends to complete.
 	 * NB we should be safe from RDMA now that the QP has changed state
 	 */
+	CDEBUG(D_NET, "abort connection with %s\n",
+	       libcfs_nid2str(conn->ibc_peer->ibp_nid));
+
 	kiblnd_abort_txs(conn, &conn->ibc_tx_noops);
 	kiblnd_abort_txs(conn, &conn->ibc_tx_queue);
 	kiblnd_abort_txs(conn, &conn->ibc_tx_queue_rsrvd);
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#24 lore raw

PATCH 24/32 lnet: o2iblnd: debug message is missing a newline

In reply to James Simmons

From: Serguei Smirnov <[email protected]>

Add missing newline to one of the debug messages in kiblnd_pool_alloc_node.

WC-bug-id: https://jira.whamcloud.com/browse/LU-15984
Lustre-commit: dd670d968a44f0a70 ("LU-15984 o2iblnd: debug message is missing a newline")

Reviewed-on: https://review.whamcloud.com/47933

---
 net/lnet/klnds/o2iblnd/o2iblnd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/lnet/klnds/o2iblnd/o2iblnd.c +1 -1
index 65bc89b..ea28c65 100644
@@ -1887,7 +1887,7 @@ struct list_head *kiblnd_pool_alloc_node(struct kib_poolset *ps)
 	CDEBUG(D_NET, "%s pool exhausted, allocate new pool\n", ps->ps_name);
 	time_before = ktime_get();
 	rc = ps->ps_pool_create(ps, ps->ps_pool_size, &pool);
-	CDEBUG(D_NET, "ps_pool_create took %lld ms to complete",
+	CDEBUG(D_NET, "ps_pool_create took %lld ms to complete\n",
 	       ktime_ms_delta(ktime_get(), time_before));
 
 	spin_lock(&ps->ps_lock);
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#25 lore raw

PATCH 25/32 lustre: quota: skip non-exist or inact tgt for lfs_quota

In reply to James Simmons

From: Hongchao Zhang <[email protected]>

The nonexistent or inactive targets (MDC or OSC) should be skipped for quota reporting.

WC-bug-id: https://jira.whamcloud.com/browse/LU-14472
Lustre-commit: b54b7ce43929ce7ff ("LU-14472 quota: skip non-exist or inact tgt for lfs_quota")

Reviewed-on: https://review.whamcloud.com/41771

---
 fs/lustre/llite/dir.c   |  8 +++-----
 fs/lustre/lmv/lmv_obd.c | 15 +++++++++++++--
 fs/lustre/lov/lov_obd.c | 13 ++++++++++++-
 3 files changed, 28 insertions(+), 8 deletions(-)
fs/lustre/llite/dir.c +3 -5
index 2b63c48..26c9ec3 100644
@@ -1215,10 +1215,9 @@ int quotactl_ioctl(struct super_block *sb, struct if_quotactl *qctl)
 			break;
 		}
 
+		qctl->qc_cmd = cmd;
 		if (rc)
 			return rc;
-
-		qctl->qc_cmd = cmd;
 	} else {
 		struct obd_quotactl *oqctl;
 		int oqctl_len = sizeof(*oqctl);
@@ -2009,10 +2008,9 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 		}
 
 		rc = quotactl_ioctl(inode->i_sb, qctl);
-		if (rc == 0 && copy_to_user((void __user *)arg, qctl,
-					    sizeof(*qctl)))
+		if ((rc == 0 || rc == -ENODATA) &&
+		    copy_to_user((void __user *)arg, qctl, sizeof(*qctl)))
 			rc = -EFAULT;
-
 out_quotactl:
 		kfree(qctl);
 		return rc;
fs/lustre/lmv/lmv_obd.c +13 -2
index 8656d6b..6c0eb03 100644
@@ -845,6 +845,7 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp,
 	case OBD_IOC_QUOTACTL: {
 		struct if_quotactl *qctl = karg;
 		struct obd_quotactl *oqctl;
+		struct obd_import *imp;
 
 		if (qctl->qc_valid == QC_MDTIDX) {
 			tgt = lmv_tgt(lmv, qctl->qc_idx);
@@ -863,9 +864,19 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp,
 			return -EINVAL;
 		}
 
-		if (!tgt || !tgt->ltd_exp)
+		if (!tgt)
+			return -ENODEV;
+
+		if (!tgt->ltd_exp)
 			return -EINVAL;
 
+		imp = class_exp2cliimp(tgt->ltd_exp);
+		if (!tgt->ltd_active && imp->imp_state != LUSTRE_IMP_IDLE) {
+			qctl->qc_valid = QC_MDTIDX;
+			qctl->obd_uuid = tgt->ltd_uuid;
+			return -ENODATA;
+		}
+
 		oqctl = kzalloc(sizeof(*oqctl), GFP_KERNEL);
 		if (!oqctl)
 			return -ENOMEM;
@@ -3122,7 +3133,7 @@ static int lmv_get_info(const struct lu_env *env, struct obd_export *exp,
 			exp->exp_connect_data = *(struct obd_connect_data *)val;
 		return rc;
 	} else if (KEY_IS(KEY_TGT_COUNT)) {
-		*((int *)val) = lmv->lmv_mdt_descs.ltd_lmv_desc.ld_tgt_count;
+		*((int *)val) = lmv->lmv_mdt_descs.ltd_tgts_size;
 		return 0;
 	}
 
fs/lustre/lov/lov_obd.c +12 -1
index 161226f..d2fe8c3 100644
@@ -1021,13 +1021,17 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 		struct if_quotactl *qctl = karg;
 		struct lov_tgt_desc *tgt = NULL;
 		struct obd_quotactl *oqctl;
+		struct obd_import *imp;
 
 		if (qctl->qc_valid == QC_OSTIDX) {
 			if (count <= qctl->qc_idx)
 				return -EINVAL;
 
 			tgt = lov->lov_tgts[qctl->qc_idx];
-			if (!tgt || !tgt->ltd_exp)
+			if (!tgt)
+				return -ENODEV;
+
+			if (!tgt->ltd_exp)
 				return -EINVAL;
 		} else if (qctl->qc_valid == QC_UUID) {
 			for (i = 0; i < count; i++) {
@@ -1050,6 +1054,13 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 			return -EAGAIN;
 
 		LASSERT(tgt && tgt->ltd_exp);
+		imp = class_exp2cliimp(tgt->ltd_exp);
+		if (!tgt->ltd_active && imp->imp_state != LUSTRE_IMP_IDLE) {
+			qctl->qc_valid = QC_OSTIDX;
+			qctl->obd_uuid = tgt->ltd_uuid;
+			return -ENODATA;
+		}
+
 		oqctl = kzalloc(sizeof(*oqctl), GFP_NOFS);
 		if (!oqctl)
 			return -ENOMEM;
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#26 lore raw

PATCH 26/32 lustre: mdc: pack default LMV in open reply

In reply to James Simmons

From: Lai Siyao <[email protected]>

Add flag MDS_OPEN_DEFAULT_LMV to indicate that default LMV should be packed in open reply, otherwise if open fetches LOOKUP lock, client won't know directory has default LMV, and in subdir creation default LMV won't take effect.

WC-bug-id: https://jira.whamcloud.com/browse/LU-15850
Lustre-commit: f6e4272fb0be5b798 ("LU-15850 mdt: pack default LMV in open reply")

Reviewed-on: https://review.whamcloud.com/47576

---
 fs/lustre/mdc/mdc_lib.c                 | 1 +
 fs/lustre/mdc/mdc_locks.c               | 2 ++
 fs/lustre/ptlrpc/layout.c               | 1 +
 fs/lustre/ptlrpc/wiretest.c             | 2 ++
 include/uapi/linux/lustre/lustre_user.h | 5 ++++-
 5 files changed, 10 insertions(+), 1 deletion(-)
fs/lustre/mdc/mdc_lib.c +1 -0
index 51080a1..077639d 100644
@@ -329,6 +329,7 @@ void mdc_open_pack(struct req_capsule *pill, struct md_op_data *op_data,
 			rec->cr_archive_id = op_data->op_archive_id;
 		}
 	}
+	cr_flags |= MDS_OPEN_DEFAULT_LMV;
 	set_mrc_cr_flags(rec, cr_flags);
 }
 
fs/lustre/mdc/mdc_locks.c +2 -0
index b86d1b9..2a9b9a8 100644
@@ -393,6 +393,8 @@ static int mdc_save_lovea(struct ptlrpc_request *req, void *data, u32 size)
 	 */
 	req_capsule_set_size(&req->rq_pill, &RMF_NIOBUF_INLINE, RCL_SERVER,
 			     sizeof(struct niobuf_remote));
+	req_capsule_set_size(&req->rq_pill, &RMF_DEFAULT_MDT_MD, RCL_SERVER,
+			     sizeof(struct lmv_user_md));
 	ptlrpc_request_set_replen(req);
 
 	/* Get real repbuf allocated size as rounded up power of 2 */
fs/lustre/ptlrpc/layout.c +1 -0
index 8725edd..82ec899 100644
@@ -447,6 +447,7 @@
 	&RMF_NIOBUF_INLINE,
 	&RMF_FILE_SECCTX,
 	&RMF_FILE_ENCCTX,
+	&RMF_DEFAULT_MDT_MD,
 };
 
 static const struct req_msg_field *ldlm_intent_getattr_client[] = {
fs/lustre/ptlrpc/wiretest.c +2 -0
index 81e0485..60a7fd0 100644
@@ -2326,6 +2326,8 @@ void lustre_assert_wire_constants(void)
 		 (long long)MDS_OPEN_RESYNC);
 	LASSERTF(MDS_OPEN_PCC == 00000000010000000000000ULL, "found 0%.22lloULL\n",
 		 (long long)MDS_OPEN_PCC);
+	LASSERTF(MDS_OPEN_DEFAULT_LMV == 00000000040000000000000ULL, "found 0%.22lloULL\n",
+		 (long long)MDS_OPEN_DEFAULT_LMV);
 	LASSERTF(LUSTRE_SYNC_FL == 0x00000008, "found 0x%.8x\n",
 		 LUSTRE_SYNC_FL);
 	LASSERTF(LUSTRE_IMMUTABLE_FL == 0x00000010, "found 0x%.8x\n",
include/uapi/linux/lustre/lustre_user.h +4 -1
index c57929b..7b79604 100644
@@ -1246,12 +1246,15 @@ enum la_valid {
 					      * for newly created file
 					      */
 #define MDS_OP_WITH_FID	  020000000000000ULL /* operation carried out by FID */
+#define MDS_OPEN_DEFAULT_LMV  040000000000000ULL /* open fetches default LMV */
 
+/* lustre internal open flags, which should not be set from user space */
 #define MDS_OPEN_FL_INTERNAL (MDS_OPEN_HAS_EA | MDS_OPEN_HAS_OBJS |	\
 			      MDS_OPEN_OWNEROVERRIDE | MDS_OPEN_LOCK |	\
 			      MDS_OPEN_BY_FID | MDS_OPEN_LEASE |	\
 			      MDS_OPEN_RELEASE | MDS_OPEN_RESYNC |	\
-			      MDS_OPEN_PCC | MDS_OP_WITH_FID)
+			      MDS_OPEN_PCC | MDS_OP_WITH_FID |		\
+			      MDS_OPEN_DEFAULT_LMV)
 
 /********* Changelogs **********/
 /** Changelog record types */
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#27 lore raw

PATCH 27/32 lnet: Define KFILND network type

In reply to James Simmons

From: Chris Horn <[email protected]>

Define the KFILND network type. This reserves the network type number for future implementation and allows creation of kfi peers and adding routes to kfi peers.

HPE-bug-id: LUS-11060

WC-bug-id: https://jira.whamcloud.com/browse/LU-15983
Lustre-commit: 5fea36c952373c9a2 ("LU-15983 lnet: Define KFILND network type")

Reviewed-on: https://review.whamcloud.com/47830

---
 include/uapi/linux/lnet/nidstr.h |  1 +
 net/lnet/lnet/nidstrings.c       | 10 ++++++++++
 2 files changed, 11 insertions(+)
include/uapi/linux/lnet/nidstr.h +1 -0
index 80be2eb..d5829fe 100644
@@ -55,6 +55,7 @@ enum {
 	GNILND		= 13,
 	GNIIPLND	= 14,
 	PTL4LND		= 15,
+	KFILND		= 16,
 
 	NUM_LNDS
 };
net/lnet/lnet/nidstrings.c +10 -0
index 3523b78..ac2aa97 100644
@@ -758,6 +758,16 @@ int cfs_print_nidlist(char *buffer, int count, struct list_head *nidlist)
 	  .nf_print_addrlist	= libcfs_num_addr_range_print,
 	  .nf_match_addr	= libcfs_num_match
 	},
+	{
+	  .nf_type		= KFILND,
+	  .nf_name		= "kfi",
+	  .nf_modname		= "kkfilnd",
+	  .nf_addr2str		= libcfs_decnum_addr2str,
+	  .nf_str2addr		= libcfs_num_str2addr,
+	  .nf_parse_addrlist	= libcfs_num_parse,
+	  .nf_print_addrlist	= libcfs_num_addr_range_print,
+	  .nf_match_addr	= libcfs_num_match
+	},
 };
 
 static const size_t libcfs_nnetstrfns = ARRAY_SIZE(libcfs_netstrfns);
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#28 lore raw

PATCH 28/32 lnet: Adjust niov checks for large MD

In reply to James Simmons

From: Chris Horn <[email protected]>

An LNet user can allocate a large contiguous MD. That MD can have > LNET_MAX_IOV pages which causes some LNDs to assert on either niov argument passed to lnd_recv() or the value stored in lnet_msg::msg_niov. This is true even in cases where the actual transfer size is <= LNET_MTU and will not exceed limits in the LNDs.

Adjust ksocklnd_send()/ksocklnd_recv() to assert on the return value of lnet_extract_kiov().

Remove the assert on msg_niov (payload_niov) from kiblnd_send(). kiblnd_setup_rd_kiov() will already fail if we exceed ko2iblnd's available scatter gather entries.

HPE-bug-id: LUS-10878

Fixes 05cd1717bb ("lnet: always put a page list into struct lnet_libmd")

WC-bug-id: https://jira.whamcloud.com/browse/LU-15851
Lustre-commit: 105193b4a147257a0 ("LU-15851 lnet: Adjust niov checks for large MD")

Reviewed-on: https://review.whamcloud.com/47319

---
 net/lnet/klnds/o2iblnd/o2iblnd_cb.c | 1 -
 net/lnet/klnds/socklnd/socklnd_cb.c | 5 +++--
 2 files changed, 3 insertions(+), 3 deletions(-)
net/lnet/klnds/o2iblnd/o2iblnd_cb.c +0 -1
index d4d8954..30e77c0 100644
@@ -1564,7 +1564,6 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,
 	       payload_nob, payload_niov, libcfs_idstr(target));
 
 	LASSERT(!payload_nob || payload_niov > 0);
-	LASSERT(payload_niov <= LNET_MAX_IOV);
 
 	/* Thread context */
 	LASSERT(!in_interrupt());
net/lnet/klnds/socklnd/socklnd_cb.c +3 -2
index 94600f3..308d8b0 100644
@@ -936,7 +936,6 @@ struct ksock_conn_cb *
 	       payload_nob, payload_niov, libcfs_idstr(target));
 
 	LASSERT(!payload_nob || payload_niov > 0);
-	LASSERT(payload_niov <= LNET_MAX_IOV);
 	LASSERT(!in_interrupt());
 
 	desc_size = offsetof(struct ksock_tx,
@@ -962,6 +961,8 @@ struct ksock_conn_cb *
 					 payload_niov, payload_kiov,
 					 payload_offset, payload_nob);
 
+	LASSERT(tx->tx_nkiov <= LNET_MAX_IOV);
+
 	if (payload_nob >= *ksocknal_tunables.ksnd_zc_min_payload)
 		tx->tx_zc_capable = 1;
 
@@ -1278,13 +1279,13 @@ struct ksock_conn_cb *
 	struct ksock_sched *sched = conn->ksnc_scheduler;
 
 	LASSERT(iov_iter_count(to) <= rlen);
-	LASSERT(to->nr_segs <= LNET_MAX_IOV);
 
 	conn->ksnc_lnet_msg = msg;
 	conn->ksnc_rx_nob_left = rlen;
 
 	conn->ksnc_rx_to = *to;
 
+	LASSERT(conn->ksnc_rx_to.nr_segs <= LNET_MAX_IOV);
 	LASSERT(conn->ksnc_rx_scheduled);
 
 	spin_lock_bh(&sched->kss_lock);
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#29 lore raw

PATCH 29/32 lustre: ec: code to add support for M to N parity

In reply to James Simmons

This code adds basic functionality for calculating N parities for M data units. This allows much more than just working with raid6 calculations. The code is derived from the Intel isa-l userland library. Keep the code in an separate module for easy merger upstream at a latter time.

WC-bug-id: https://jira.whamcloud.com/browse/LU-12189
Lustre-commit: 047347170b8aece43 ("LU-12189 ec: code to add support for M to N parity")

Reviewed-on: https://review.whamcloud.com/47628

---
 fs/lustre/Makefile               |   2 +-
 fs/lustre/ec/Makefile            |   4 +
 fs/lustre/ec/ec_base.c           | 352 +++++++++++++++++++++++++++++++++++++++
 fs/lustre/include/erasure_code.h | 142 ++++++++++++++++
 4 files changed, 499 insertions(+), 1 deletion(-)
 create mode 100644 fs/lustre/ec/Makefile
 create mode 100644 fs/lustre/ec/ec_base.c
 create mode 100644 fs/lustre/include/erasure_code.h
fs/lustre/Makefile +1 -1
index 4a02463..4af6ff6 100644
@@ -1,3 +1,3 @@
 
-obj-$(CONFIG_LUSTRE_FS) += obdclass/ ptlrpc/ fld/ osc/ mgc/ \
+obj-$(CONFIG_LUSTRE_FS) += obdclass/ ptlrpc/ fld/ osc/ mgc/ ec/ \
 			   fid/ lov/ mdc/ lmv/ llite/ obdecho/
fs/lustre/ec/Makefile new file +4 -0
new file mode 100644
index 0000000..aba8ea3
@@ -0,0 +1,4 @@
+ccflags-y += -I$(srctree)/$(src)/../include
+
+obj-$(CONFIG_LUSTRE_FS) += ec.o
+ec-y := ec_base.o
fs/lustre/ec/ec_base.c new file +352 -0

352 lines not on this page · raw message

fs/lustre/include/erasure_code.h new file +142 -0

142 lines not on this page · raw message

Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#30 lore raw

PATCH 30/32 lustre: llite: use max default EA size to get default LMV

In reply to James Simmons

From: Lai Siyao <[email protected]>

Subdir mount will fetch ROOT default LMV and set it, but the default EA size cl_default_mds_easize may not be set for MDT0 yet, because it's updated upon getattr/enqueue, and if subdir mount is not on MDT0, it may not be initialized yet. Use max EA size to fetch default layout in ll_dir_get_default_layout().

Fixes 4cee9af853 ("lustre: llite: enforce ROOT default on subdir mount")

WC-bug-id: https://jira.whamcloud.com/browse/LU-15910
Lustre-commit: bb588480d4cdd6847 ("LU-15910 llite: use max default EA size to get default LMV")

Reviewed-on: https://review.whamcloud.com/47937

---
 fs/lustre/llite/dir.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
fs/lustre/llite/dir.c +4 -8
index 26c9ec3..3384d81 100644
@@ -663,17 +663,13 @@ int ll_dir_get_default_layout(struct inode *inode, void **plmm, int *plmm_size,
 	struct mdt_body *body;
 	struct lov_mds_md *lmm = NULL;
 	struct ptlrpc_request *req = NULL;
-	int rc, lmmsize;
+	int lmmsize = OBD_MAX_DEFAULT_EA_SIZE;
 	struct md_op_data *op_data;
 	struct lu_fid fid;
+	int rc;
 
-	rc = ll_get_max_mdsize(sbi, &lmmsize);
-	if (rc)
-		return rc;
-
-	op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL,
-				     0, lmmsize, LUSTRE_OPC_ANY,
-				     NULL);
+	op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, lmmsize,
+				     LUSTRE_OPC_ANY, NULL);
 	if (IS_ERR(op_data))
 		return PTR_ERR(op_data);
 
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#31 lore raw

PATCH 31/32 lustre: llite: pass dmv inherit depth instead of dir depth

In reply to James Simmons

From: Lai Siyao <[email protected]>

In directory creation, once it's ancestor has default LMV, pass the inherit depth, otherwise pass the directory depth to ROOT.

This depth will be used in QoS allocation.

WC-bug-id: https://jira.whamcloud.com/browse/LU-15850
Lustre-commit: c23c68a52a0436910 ("LU-15850 llite: pass dmv inherit depth instead of dir depth")

Reviewed-on: https://review.whamcloud.com/47577

---
 fs/lustre/include/lustre_lmv.h   | 23 +++++++++++++++++--
 fs/lustre/llite/dir.c            |  3 ++-
 fs/lustre/llite/llite_internal.h |  4 ++++
 fs/lustre/llite/llite_lib.c      | 48 +++++++++++++++++++++++++++++++++++++---
 fs/lustre/llite/namei.c          |  4 ++--
 5 files changed, 74 insertions(+), 8 deletions(-)
fs/lustre/include/lustre_lmv.h +21 -2
index cd7cf9e..3720a97 100644
@@ -51,8 +51,6 @@ struct lmv_stripe_md {
 	u32	lsm_md_layout_version;
 	u32	lsm_md_migrate_offset;
 	u32	lsm_md_migrate_hash;
-	u32	lsm_md_default_count;
-	u32	lsm_md_default_index;
 	char	lsm_md_pool_name[LOV_MAXPOOLNAME + 1];
 	struct lmv_oinfo lsm_md_oinfo[0];
 };
@@ -513,4 +511,25 @@ static inline bool lmv_is_layout_changing(const struct lmv_mds_md_v1 *lmv)
 	       lmv_hash_is_migrating(cpu_to_le32(lmv->lmv_hash_type));
 }
 
+static inline u8 lmv_inherit_next(u8 inherit)
+{
+	if (inherit == LMV_INHERIT_END || inherit == LMV_INHERIT_NONE)
+		return LMV_INHERIT_NONE;
+
+	if (inherit == LMV_INHERIT_UNLIMITED || inherit > LMV_INHERIT_MAX)
+		return inherit;
+
+	return inherit - 1;
+}
+
+static inline u8 lmv_inherit_rr_next(u8 inherit_rr)
+{
+	if (inherit_rr == LMV_INHERIT_RR_NONE ||
+	    inherit_rr == LMV_INHERIT_RR_UNLIMITED ||
+	    inherit_rr > LMV_INHERIT_RR_MAX)
+		return inherit_rr;
+
+	return inherit_rr - 1;
+}
+
 #endif
fs/lustre/llite/dir.c +2 -1
index 3384d81..aea15f5 100644
@@ -491,7 +491,8 @@ static int ll_dir_setdirstripe(struct dentry *dparent, struct lmv_user_md *lump,
 	if (IS_ERR(op_data))
 		return PTR_ERR(op_data);
 
-	op_data->op_dir_depth = ll_i2info(parent)->lli_dir_depth;
+	op_data->op_dir_depth = ll_i2info(parent)->lli_inherit_depth ?:
+				ll_i2info(parent)->lli_dir_depth;
 
 	if (ll_sbi_has_encrypt(sbi) &&
 	    (IS_ENCRYPTED(parent) ||
fs/lustre/llite/llite_internal.h +4 -0
index c350440..2139f88 100644
@@ -183,6 +183,10 @@ struct ll_inode_info {
 			pid_t				lli_opendir_pid;
 			/* directory depth to ROOT */
 			unsigned short			lli_dir_depth;
+			/* directory depth to ancestor whose default LMV is
+			 * inherited.
+			 */
+			unsigned short			lli_inherit_depth;
 			/* stat will try to access statahead entries or start
 			 * statahead if this flag is set, and this flag will be
 			 * set upon dir open, and cleared when dir is closed,
fs/lustre/llite/llite_lib.c +45 -3

70 lines not on this page · raw message

fs/lustre/llite/namei.c +2 -2
index cc7b243..2215dd8 100644
@@ -1496,7 +1496,7 @@ static void ll_qos_mkdir_prep(struct md_op_data *op_data, struct inode *dir)
 	struct ll_inode_info *lli = ll_i2info(dir);
 	struct lmv_stripe_md *lsm;
 
-	op_data->op_dir_depth = lli->lli_dir_depth;
+	op_data->op_dir_depth = lli->lli_inherit_depth ?: lli->lli_dir_depth;
 
 	/* parent directory is striped */
 	if (unlikely(lli->lli_lsm_md))
@@ -1635,7 +1635,7 @@ static int ll_new_node(struct inode *dir, struct dentry *dchild,
 			from_kuid(&init_user_ns, current_fsuid()),
 			from_kgid(&init_user_ns, current_fsgid()),
 			current_cap(), rdev, &request);
-#if OBD_OCD_VERSION(2, 14, 58, 0) > LUSTRE_VERSION_CODE
+#if OBD_OCD_VERSION(2, 14, 58, 0) < LUSTRE_VERSION_CODE
 	/*
 	 * server < 2.12.58 doesn't pack default LMV in intent_getattr reply,
 	 * fetch default LMV here.
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
#32 lore raw

PATCH 32/32 lustre: ldlm: Prioritize blocking callbacks

In reply to James Simmons

From: Patrick Farrell <[email protected]>

The current code places bl_ast lock callbacks at the end of the global BL callback queue. This is bad because it causes urgent requests from the server to wait behind non-urgent cleanup tasks to keep lru_size at the right level.

This can lead to evictions if there is a large queue of items in the global queue so the callback is not serviced in a timely manner.

Put bl_ast callbacks on the priority queue so they do not wait behind the background traffic.

Add some additional debug in this area.

WC-bug-id: https://jira.whamcloud.com/browse/LU-15821
Lustre-commit: 2d59294d52b696125 ("LU-15821 ldlm: Prioritize blocking callbacks")

Reviewed-on: https://review.whamcloud.com/47215

---
 fs/lustre/ldlm/ldlm_lockd.c | 39 +++++++++++++++++++++++++++++++++++++--
 1 file changed, 37 insertions(+), 2 deletions(-)
fs/lustre/ldlm/ldlm_lockd.c +37 -2
index 04fe92e..9f89766 100644
@@ -94,6 +94,8 @@ struct ldlm_bl_pool {
 	atomic_t		blp_busy_threads;
 	int			blp_min_threads;
 	int			blp_max_threads;
+	int			blp_total_locks;
+	int			blp_total_blwis;
 };
 
 struct ldlm_bl_work_item {
@@ -399,19 +401,39 @@ static int __ldlm_bl_to_thread(struct ldlm_bl_work_item *blwi,
 			       enum ldlm_cancel_flags cancel_flags)
 {
 	struct ldlm_bl_pool *blp = ldlm_state->ldlm_bl_pool;
+	char *prio = "regular";
+	int count;
 
 	spin_lock(&blp->blp_lock);
-	if (blwi->blwi_lock && ldlm_is_discard_data(blwi->blwi_lock)) {
-		/* add LDLM_FL_DISCARD_DATA requests to the priority list */
+	/* cannot access blwi after added to list and lock is dropped */
+	count = blwi->blwi_lock ? 1 : blwi->blwi_count;
+
+	/* if the server is waiting on a lock to be cancelled (bl_ast), this is
+	 * an urgent request and should go in the priority queue so it doesn't
+	 * get stuck behind non-priority work (eg, lru size management)
+	 *
+	 * We also prioritize discard_data, which is for eviction handling
+	 */
+	if (blwi->blwi_lock &&
+	    (ldlm_is_discard_data(blwi->blwi_lock) ||
+	     ldlm_is_bl_ast(blwi->blwi_lock))) {
 		list_add_tail(&blwi->blwi_entry, &blp->blp_prio_list);
+		prio = "priority";
 	} else {
 		/* other blocking callbacks are added to the regular list */
 		list_add_tail(&blwi->blwi_entry, &blp->blp_list);
 	}
+	blp->blp_total_locks += count;
+	blp->blp_total_blwis++;
 	spin_unlock(&blp->blp_lock);
 
 	wake_up(&blp->blp_waitq);
 
+	/* unlocked read of blp values is intentional - OK for debug */
+	CDEBUG(D_DLMTRACE,
+	       "added %d/%d locks to %s blp list, %d blwis in pool\n",
+	       count, blp->blp_total_locks, prio, blp->blp_total_blwis);
+
 	/*
 	 * Can not check blwi->blwi_flags as blwi could be already freed in
 	 * LCF_ASYNC mode
@@ -772,6 +794,17 @@ static int ldlm_bl_get_work(struct ldlm_bl_pool *blp,
 	spin_unlock(&blp->blp_lock);
 	*p_blwi = blwi;
 
+	/* intentional unlocked read of blp values - OK for debug */
+	if (blwi) {
+		CDEBUG(D_DLMTRACE,
+		       "Got %d locks of %d total in blp.  (%d blwis in pool)\n",
+		       blwi->blwi_lock ? 1 : blwi->blwi_count,
+		       blp->blp_total_locks, blp->blp_total_blwis);
+	} else {
+		CDEBUG(D_DLMTRACE,
+		       "No blwi found in queue (no bl locks in queue)\n");
+	}
+
 	return (*p_blwi || *p_exp) ? 1 : 0;
 }
 
@@ -1126,6 +1159,8 @@ static int ldlm_setup(void)
 	init_waitqueue_head(&blp->blp_waitq);
 	atomic_set(&blp->blp_num_threads, 0);
 	atomic_set(&blp->blp_busy_threads, 0);
+	blp->blp_total_locks = 0;
+	blp->blp_total_blwis = 0;
 
 	if (ldlm_num_threads == 0) {
 		blp->blp_min_threads = LDLM_NTHRS_INIT;
Signature · 6 lines
1.8.3.1

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org