Skip to contentSkip to conversation

lustre: sync to OpenSFS June 15, 2022

PATCH New James Simmons 1 participant 29 messages Jun 18, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover lustre: sync to OpenSFS June 15, 2022

Backport OpenSFS work as of June 15, 2022. Move to a Linux 5.9 kernel.

Alex Zhuravlev (2):
lnet: libcfs: reset hs_rehash_bits
lustre: ptlrpc: don't report eviction for light weigth connections

Alexander Boyko (2):
lustre: lmv: try another MDT if statfs failed
lustre: lmv: skip qos for qos_threshold_rr=100

Andreas Dilger (1):
lnet: libcfs: add "default" keyword for debug mask

Andrew Elwell (1):
lustre: ptlrpc: Rearrange version mismatch message

Bobi Jam (1):
lustre: ec: add necessary structure member for EC file

Chris Horn (4):
lnet: Ping buffer ref leak in lnet_peer_data_present
lnet: DLC sets map_on_demand incorrectly
lnet: Return ESHUTDOWN in lnet_parse()
lnet: libcfs: libcfs_debug_mb set incorrectly on init

Cyril Bordage (1):
lnet: set max recovery interval duration

James Simmons (2):
lustre: sec: support test_dummy_encryption=v2
lustre: uapi: avoid gcc-11 -Werror=stringop-overread warning

John L. Hammond (1):
lustre: lov: remove lov_page

Lai Siyao (1):
lustre: llite: add option to disable Lustre inode cache

Mr NeilBrown (4):
lustre: osc: handle removal of NR_UNSTABLE_NFS
lustre: llite: switch from ->mmap_sem to mmap_lock()
lnet: support removal of kernel_setsockopt()
lnet: improve compat code for IPV6_V6ONLY sock opt

Patrick Farrell (6):
lustre: llite: Correct cl_env comments
lustre: llite: Make iotrace logging quieter
lustre: llite: Add strided readahead to iotrace
lustre: llite: Add FID to async ra iotrace
lustre: llite: Add COMPLETED iotrace messages
lustre: osc: Add RPC to iotrace

Sergey Gorenko (1):
lnet: o2ib: Fix compilation with Linux 5.8

Serguei Smirnov (1):
lnet: o2iblnd: clean up zombie connections on shutdown

 fs/lustre/include/cl_object.h              |  13 ++-
 fs/lustre/include/lu_object.h              |   1 +
 fs/lustre/include/lustre_crypto.h          |  15 ++--
 fs/lustre/include/lustre_disk.h            |   3 +
 fs/lustre/llite/crypto.c                   |  30 +++----
 fs/lustre/llite/dir.c                      |   2 +-
 fs/lustre/llite/file.c                     |  12 +++
 fs/lustre/llite/llite_internal.h           |  17 ++--
 fs/lustre/llite/llite_lib.c                |  34 ++++++--
 fs/lustre/llite/llite_mmap.c               |  20 +++--
 fs/lustre/llite/lproc_llite.c              |  31 +++++++
 fs/lustre/llite/namei.c                    |   3 +-
 fs/lustre/llite/pcc.c                      |   6 +-
 fs/lustre/llite/rw.c                       |  17 ++--
 fs/lustre/llite/super25.c                  |   7 +-
 fs/lustre/llite/vvp_io.c                   |   4 +-
 fs/lustre/lmv/lmv_obd.c                    |  11 ++-
 fs/lustre/lmv/lproc_lmv.c                  |   5 +-
 fs/lustre/lov/lov_cl_internal.h            |  32 +++----
 fs/lustre/lov/lov_object.c                 |   5 +-
 fs/lustre/lov/lov_page.c                   |  46 ++--------
 fs/lustre/obdclass/cl_object.c             |  32 +++----
 fs/lustre/obdclass/lu_tgt_descs.c          |  12 ++-
 fs/lustre/osc/osc_page.c                   |   4 +-
 fs/lustre/osc/osc_request.c                |  16 +++-
 fs/lustre/ptlrpc/import.c                  |  10 ++-
 fs/lustre/ptlrpc/pack_generic.c            |   4 +
 fs/lustre/ptlrpc/wiretest.c                |  24 +++++-
 include/linux/libcfs/libcfs_string.h       |   3 +-
 include/linux/lnet/lib-lnet.h              |  13 +--
 include/uapi/linux/lnet/libcfs_debug.h     | 129 +++++++++++++++--------------
 include/uapi/linux/lustre/lustre_user.h    |  46 ++++++----
 net/lnet/klnds/o2iblnd/o2iblnd.c           |   6 ++
 net/lnet/klnds/o2iblnd/o2iblnd_cb.c        |   3 +-
 net/lnet/klnds/o2iblnd/o2iblnd_modparams.c |   3 +
 net/lnet/klnds/socklnd/socklnd_lib.c       | 123 ++++++++-------------------
 net/lnet/libcfs/debug.c                    |  20 ++---
 net/lnet/libcfs/hash.c                     |  11 ++-
 net/lnet/libcfs/libcfs_string.c            |  11 ++-
 net/lnet/libcfs/tracefile.c                |   5 +-
 net/lnet/lnet/api-ni.c                     |  49 +++++++++++
 net/lnet/lnet/lib-move.c                   |   2 +-
 net/lnet/lnet/lib-socket.c                 |  57 ++++---------
 net/lnet/lnet/peer.c                       |   9 +-
 44 files changed, 506 insertions(+), 400 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/28 lustre: osc: handle removal of NR_UNSTABLE_NFS

From: Mr NeilBrown <[email protected]>

In Linux 5.8 the NR_UNSTABLE_NFS page counters are go. All pages that have been writen but are not yet safe are now counted in NR_WRITEBACK.

So change osc_page to count in NR_WRITEBACK.

WC-bug-id: https://jira.whamcloud.com/browse/LU-13783
Lustre-commit: 3e5faa441266cd8d ("LU-13783 osc: handle removal of NR_UNSTABLE_NFS")

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

---
 fs/lustre/osc/osc_page.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/lustre/osc/osc_page.c +2 -2
index b56bc1a..fd87698 100644
@@ -934,7 +934,7 @@ static inline void unstable_page_accounting(struct ptlrpc_bulk_desc *desc,
 		}
 
 		if (count > 0) {
-			mod_node_page_state(pgdat, NR_UNSTABLE_NFS,
+			mod_node_page_state(pgdat, NR_WRITEBACK,
 					    factor * count);
 			count = 0;
 		}
@@ -942,7 +942,7 @@ static inline void unstable_page_accounting(struct ptlrpc_bulk_desc *desc,
 		++count;
 	}
 	if (count > 0)
-		mod_node_page_state(last, NR_UNSTABLE_NFS, factor * count);
+		mod_node_page_state(last, NR_WRITEBACK, factor * count);
 }
 
 static inline void add_unstable_page_accounting(struct ptlrpc_bulk_desc *desc,
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 2/28 lustre: llite: switch from ->mmap_sem to mmap_lock()

In reply to James Simmons

From: Mr NeilBrown <[email protected]>

In Linux 5.8, ->mmap_sem is gone and the preferred interface for locking the mmap is to suite of mmap*lock() functions.

WC-bug-id: https://jira.whamcloud.com/browse/LU-13783
Lustre-commit: 5309e108582c692f ("LU-13783 libcfs: switch from ->mmap_sem to mmap_lock()")

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

---
 fs/lustre/llite/llite_internal.h | 12 ++++++------
 fs/lustre/llite/llite_mmap.c     |  8 ++++----
 fs/lustre/llite/pcc.c            |  6 +++---
 fs/lustre/llite/vvp_io.c         |  4 ++--
 4 files changed, 15 insertions(+), 15 deletions(-)
fs/lustre/llite/llite_internal.h +6 -6
index bc50169..426c797 100644
@@ -299,11 +299,11 @@ static inline void ll_trunc_sem_init(struct ll_trunc_sem *sem)
  *
  * We must take lli_trunc_sem in read mode on entry in to various i/o paths
  * in Lustre, in order to exclude truncates.  Some of these paths then need to
- * take the mmap_sem, while still holding the trunc_sem.  The problem is that
- * page faults hold the mmap_sem when calling in to Lustre, and then must also
+ * take the mmap_lock, while still holding the trunc_sem.  The problem is that
+ * page faults hold the mmap_lock when calling in to Lustre, and then must also
  * take the trunc_sem to exclude truncate.
  *
- * This means the locking order for trunc_sem and mmap_sem is sometimes AB,
+ * This means the locking order for trunc_sem and mmap_lock is sometimes AB,
  * sometimes BA.  This is almost OK because in both cases, we take the trunc
  * sem for read, so it doesn't block.
  *
@@ -313,9 +313,9 @@ static inline void ll_trunc_sem_init(struct ll_trunc_sem *sem)
  *
  * So we have, on our truncate sem, in order (where 'reader' and 'writer' refer
  * to the mode in which they take the semaphore):
- * reader (holding mmap_sem, needs truncate_sem)
+ * reader (holding mmap_lock, needs truncate_sem)
  * writer
- * reader (holding truncate sem, waiting for mmap_sem)
+ * reader (holding truncate sem, waiting for mmap_lock)
  *
  * And so the readers deadlock.
  *
@@ -325,7 +325,7 @@ static inline void ll_trunc_sem_init(struct ll_trunc_sem *sem)
  * of the order they arrived in.
  *
  * down_read_nowait is only used in the page fault case, where we already hold
- * the mmap_sem.  This is because otherwise repeated read and write operations
+ * the mmap_lock.  This is because otherwise repeated read and write operations
  * (which take the truncate sem) could prevent a truncate from ever starting.
  * This could still happen with page faults, but without an even more complex
  * mechanism, this is unavoidable.
fs/lustre/llite/llite_mmap.c +4 -4
index d87a68d..2e762b1 100644
@@ -63,8 +63,8 @@ struct vm_area_struct *our_vma(struct mm_struct *mm, unsigned long addr,
 {
 	struct vm_area_struct *vma, *ret = NULL;
 
-	/* mmap_sem must have been held by caller. */
-	LASSERT(!down_write_trylock(&mm->mmap_sem));
+	/* mmap_lock must have been held by caller. */
+	LASSERT(!mmap_write_trylock(mm));
 
 	for (vma = find_vma(mm, addr);
 	    vma && vma->vm_start < (addr + count); vma = vma->vm_next) {
@@ -288,11 +288,11 @@ static vm_fault_t __ll_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 		bool allow_retry = vmf->flags & FAULT_FLAG_ALLOW_RETRY;
 		bool has_retry = vmf->flags & FAULT_FLAG_RETRY_NOWAIT;
 
-		/* To avoid loops, instruct downstream to not drop mmap_sem */
+		/* To avoid loops, instruct downstream to not drop mmap_lock */
 		/**
 		 * only need FAULT_FLAG_ALLOW_RETRY prior to Linux 5.1
 		 * (6b4c9f4469819), where FAULT_FLAG_RETRY_NOWAIT is enough
-		 * to not drop mmap_sem when failed to lock the page.
+		 * to not drop mmap_lock when failed to lock the page.
 		 */
 		vmf->flags |= FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_RETRY_NOWAIT;
 		ll_cl_add(inode, env, NULL, LCC_MMAP);
fs/lustre/llite/pcc.c +3 -3
index 8bdf681e..ec35061 100644
@@ -1906,7 +1906,7 @@ vm_fault_t pcc_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
 		       "%s: PCC backend fs not support ->page_mkwrite()\n",
 		       ll_i2sbi(inode)->ll_fsname);
 		pcc_ioctl_detach(inode, PCC_DETACH_OPT_UNCACHE);
-		up_read(&mm->mmap_sem);
+		mmap_read_unlock(mm);
 		*cached = true;
 		return VM_FAULT_RETRY | VM_FAULT_NOPAGE;
 	}
@@ -1933,7 +1933,7 @@ vm_fault_t pcc_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
 		 */
 		if (page->mapping == pcc_file->f_mapping) {
 			*cached = true;
-			up_read(&mm->mmap_sem);
+			mmap_read_unlock(mm);
 			return VM_FAULT_RETRY | VM_FAULT_NOPAGE;
 		}
 
@@ -1947,7 +1947,7 @@ vm_fault_t pcc_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
 	if (OBD_FAIL_CHECK(OBD_FAIL_LLITE_PCC_DETACH_MKWRITE)) {
 		pcc_io_fini(inode);
 		pcc_ioctl_detach(inode, PCC_DETACH_OPT_UNCACHE);
-		up_read(&mm->mmap_sem);
+		mmap_read_unlock(mm);
 		return VM_FAULT_RETRY | VM_FAULT_NOPAGE;
 	}
 
fs/lustre/llite/vvp_io.c +2 -2
index 77e54ce..75c5224 100644
@@ -462,7 +462,7 @@ static int vvp_mmap_locks(const struct lu_env *env,
 		count += addr & (~PAGE_MASK);
 		addr &= PAGE_MASK;
 
-		down_read(&mm->mmap_sem);
+		mmap_read_lock(mm);
 		while ((vma = our_vma(mm, addr, count)) != NULL) {
 			struct inode *inode = file_inode(vma->vm_file);
 			int flags = CEF_MUST;
@@ -503,7 +503,7 @@ static int vvp_mmap_locks(const struct lu_env *env,
 			count -= vma->vm_end - addr;
 			addr = vma->vm_end;
 		}
-		up_read(&mm->mmap_sem);
+		mmap_read_unlock(mm);
 		if (result < 0)
 			break;
 	}
Signature · 1 line
1.8.3.1
#3 lore raw

PATCH 3/28 lnet: support removal of kernel_setsockopt()

In reply to James Simmons

From: Mr NeilBrown <[email protected]>

Linux 5.8 removes kernel_setsockopt() and kernel_getsockopt(), and provides some helper functions for some accesses that are not trivial.

This patch adds those helpers to libcfs when they are not available, and changes (nearly) all calls to kernel_[gs]etsockopt() to either use direct access to a helper call.

->keepalive() is not available before v4.11-rc1~94^2~43^2~14 and there is no helper function, so for SO_KEEPALIVE we need to have #ifdef code in the C file.

TCP_BACKOFF* setting are not converted as they are not available in any upstream kernel, so no conversion is possible.

Also include some minor style fixes and change lnet_sock_setbuf() and
lnet_sock_getbuf() to be 'void' functions.

WC-bug-id: https://jira.whamcloud.com/browse/LU-13783
Lustre-commit: 99d9638d6c074b48 ("LU-13783 libcfs: support removal of kernel_setsockopt()")

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

---
 include/linux/lnet/lib-lnet.h        |   4 +-
 net/lnet/klnds/socklnd/socklnd_lib.c | 123 ++++++++++-------------------------
 net/lnet/lnet/lib-socket.c           |  41 +++---------
 3 files changed, 47 insertions(+), 121 deletions(-)
include/linux/lnet/lib-lnet.h +2 -2
index ca2a565..ceb12b1 100644
@@ -827,8 +827,8 @@ struct lnet_inetdev {
 };
 
 int lnet_inet_enumerate(struct lnet_inetdev **dev_list, struct net *ns);
-int lnet_sock_setbuf(struct socket *socket, int txbufsize, int rxbufsize);
-int lnet_sock_getbuf(struct socket *socket, int *txbufsize, int *rxbufsize);
+void lnet_sock_setbuf(struct socket *socket, int txbufsize, int rxbufsize);
+void lnet_sock_getbuf(struct socket *socket, int *txbufsize, int *rxbufsize);
 int lnet_sock_getaddr(struct socket *socket, bool remote,
 		      struct sockaddr_storage *peer);
 int lnet_sock_write(struct socket *sock, void *buffer, int nob, int timeout);
net/lnet/klnds/socklnd/socklnd_lib.c +36 -87

193 lines not on this page · raw message

net/lnet/lnet/lib-socket.c +9 -32

79 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#4 lore raw

PATCH 4/28 lnet: o2ib: Fix compilation with Linux 5.8

In reply to James Simmons

From: Sergey Gorenko <[email protected]>

A new argument was added to rdma_reject() in Linux 5.8

WC-bug-id: https://jira.whamcloud.com/browse/LU-13761
Lustre-commit: 956deb0fe8195c7a0 ("LU-13761 o2ib: Fix compilation with MOFED 5.1")

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

---
 net/lnet/klnds/o2iblnd/o2iblnd_cb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/lnet/klnds/o2iblnd/o2iblnd_cb.c +1 -2
index a88939e7..cb96282 100644
@@ -2323,8 +2323,7 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,
 {
 	int rc;
 
-	rc = rdma_reject(cmid, rej, sizeof(*rej));
-
+	rc = rdma_reject(cmid, rej, sizeof(*rej), IB_CM_REJ_CONSUMER_DEFINED);
 	if (rc)
 		CWARN("Error %d sending reject\n", rc);
 }
Signature · 1 line
1.8.3.1
#5 lore raw

PATCH 5/28 lnet: improve compat code for IPV6_V6ONLY sock opt

In reply to James Simmons

From: Mr NeilBrown <[email protected]>

Since linux 5.9 (v5.8-rc4-1952-ga7b75c5a8c41) it has been possible to pass a "sockptr" to ->setsockopt() which can provide a kernel address.

WC-bug-id: https://jira.whamcloud.com/browse/LU-14195
Lustre-commit: 6d111ff0dde182bfb ("LU-14195 lnet: improve compat code for IPV6_V6ONLY sock opt")

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

---
 net/lnet/lnet/lib-socket.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
net/lnet/lnet/lib-socket.c +5 -11
index 7bb8d5c..3a99cb6 100644
@@ -237,18 +237,12 @@ int choose_ipv4_src(u32 *ret, int interface, u32 dst_ipaddr, struct net *ns)
 			 * This is the default, but it can be overridden so we
 			 * force it back.
 			 */
-			/* From v5.7-rc6-2614-g5a892ff2facb when
-			 * kernel_setsockopt() was removed until
-			 * sockptr_t (above) there is no clean way to
-			 * pass kernel address to setsockopt.  We could
-			 * use get_fs()/set_fs(), but in this particular
-			 * situation there is an easier way.  It depends
-			 * on the fact that at least for these few
-			 * kernels a NULL address to ipv6_setsockopt()
-			 * is treated like the address of a zero.
+			/* sockptr_t was introduced around
+			 * v5.8-rc4-1952-ga7b75c5a8c41 and allows a
+			 * kernel address to be passed to ->setsockopt
 			 */
-			if (ipv6_only_sock(sock->sk) && !val) {
-				void *optval = NULL;
+			if (ipv6_only_sock(sock->sk)) {
+				sockptr_t optval = KERNEL_SOCKPTR(&val);
 
 				sock->ops->setsockopt(sock,
 						      IPPROTO_IPV6, IPV6_V6ONLY,
Signature · 1 line
1.8.3.1
#6 lore raw

PATCH 6/28 lustre: sec: support test_dummy_encryption=v2

In reply to James Simmons

A new version, v2, for test_dummy_encryption was added to the fscrypt API. Add support for this new test encryption to Lustre.

WC-bug-id: https://jira.whamcloud.com/browse/LU-13783
Lustre-commit: ed318a6cc0b620440 ("LU-13783 sec: support of native Ubuntu 20.04 HWE 5.8 kernel")

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

---
 fs/lustre/include/lustre_crypto.h | 15 +++++++--------
 fs/lustre/include/lustre_disk.h   |  3 +++
 fs/lustre/llite/crypto.c          | 30 +++++++++++++-----------------
 fs/lustre/llite/dir.c             |  2 +-
 fs/lustre/llite/llite_internal.h  |  2 +-
 fs/lustre/llite/llite_lib.c       | 33 +++++++++++++++++++++++++++------
 fs/lustre/llite/namei.c           |  3 ++-
 7 files changed, 54 insertions(+), 34 deletions(-)
fs/lustre/include/lustre_crypto.h +7 -8
index 6cc946d..c31cc1e 100644
@@ -32,11 +32,16 @@
 
 #include <linux/fscrypt.h>
 
+/* Macro to extract digest from Lustre specific structures */
+#define LLCRYPT_EXTRACT_DIGEST(name, len)			\
+	((name) + round_down((len) - FS_CRYPTO_BLOCK_SIZE - 1,	\
+			     FS_CRYPTO_BLOCK_SIZE))
+
 struct ll_sb_info;
 #ifdef CONFIG_FS_ENCRYPTION
 int ll_set_encflags(struct inode *inode, void *encctx, u32 encctxlen,
 		    bool preload);
-bool ll_sbi_has_test_dummy_encryption(struct ll_sb_info *sbi);
+bool ll_sb_has_test_dummy_encryption(struct super_block *sb);
 bool ll_sbi_has_encrypt(struct ll_sb_info *sbi);
 void ll_sbi_set_encrypt(struct ll_sb_info *sbi, bool set);
 #else
@@ -46,7 +51,7 @@ static inline int ll_set_encflags(struct inode *inode, void *encctx,
 	return 0;
 }
 
-static inline bool ll_sbi_has_test_dummy_encryption(struct ll_sb_info *sbi)
+static inline bool ll_sb_has_test_dummy_encryption(struct super_block *sb)
 {
 	return false;
 }
@@ -123,10 +128,4 @@ static inline int critical_decode(const u8 *src, int len, char *dst)
 	return (char *)q - dst;
 }
 
-/* Extracts the second-to-last ciphertext block */
-#define LLCRYPT_FNAME_DIGEST(name, len)					\
-	((name) + round_down((len) - FS_CRYPTO_BLOCK_SIZE - 1,		\
-			     FS_CRYPTO_BLOCK_SIZE))
-#define LLCRYPT_FNAME_DIGEST_SIZE	FS_CRYPTO_BLOCK_SIZE
-
 #endif /* _LUSTRE_CRYPTO_H_ */
fs/lustre/include/lustre_disk.h +3 -0
index d8686fc..15f94ad8 100644
@@ -47,6 +47,7 @@
 #include <asm/byteorder.h>
 #include <linux/types.h>
 #include <linux/backing-dev.h>
+#include <lustre_crypto.h>
 
 /****************** persistent mount data *********************/
 
@@ -131,6 +132,8 @@ struct lustre_sb_info {
 	struct obd_export	 *lsi_osd_exp;
 	char			  lsi_osd_type[16];
 	char			  lsi_fstype[16];
+	/* Encryption context for '-o test_dummy_encryption' */
+	struct fscrypt_dummy_context lsi_dummy_enc_ctx;
 };
 
 #define LSI_UMOUNT_FAILOVER	0x00200000
fs/lustre/llite/crypto.c +13 -17
index b0e4f76..f075b9a 100644
@@ -145,16 +145,17 @@ int ll_file_open_encrypt(struct inode *inode, struct file *filp)
 	return rc;
 }
 
-bool ll_sbi_has_test_dummy_encryption(struct ll_sb_info *sbi)
+static const union fscrypt_context *
+ll_get_dummy_context(struct super_block *sb)
 {
-	return unlikely(test_bit(LL_SBI_TEST_DUMMY_ENCRYPTION, sbi->ll_flags));
+	struct lustre_sb_info *lsi = s2lsi(sb);
+
+	return lsi ? lsi->lsi_dummy_enc_ctx.ctx : NULL;
 }
 
-static bool ll_dummy_context(struct inode *inode)
+bool ll_sb_has_test_dummy_encryption(struct super_block *sb)
 {
-	struct ll_sb_info *sbi = ll_i2sbi(inode);
-
-	return sbi ? ll_sbi_has_test_dummy_encryption(sbi) : false;
+	return ll_get_dummy_context(sb) != NULL;
 }
 
 bool ll_sbi_has_encrypt(struct ll_sb_info *sbi)
@@ -263,14 +264,14 @@ int ll_setup_filename(struct inode *dir, const struct qstr *iname,
 			rc = -EINVAL;
 			goto out_free;
 		}
-		digest = (struct ll_digest_filename *)fname->crypto_buf.name;
+		digest = (struct ll_digest_filename *)fname->disk_name.name;
 		*fid = digest->ldf_fid;
 		if (!fid_is_sane(fid)) {
 			rc = -EINVAL;
 			goto out_free;
 		}
 		fname->disk_name.name = digest->ldf_excerpt;
-		fname->disk_name.len = LLCRYPT_FNAME_DIGEST_SIZE;
+		fname->disk_name.len = sizeof(digest->ldf_excerpt);
 	}
 	if (IS_ENCRYPTED(dir) &&
 	    !name_is_dot_or_dotdot(fname->disk_name.name,
@@ -305,11 +306,6 @@ int ll_setup_filename(struct inode *dir, const struct qstr *iname,
 	return rc;
 }
 
-#define LLCRYPT_FNAME_DIGEST(name, len) \
-	((name) + round_down((len) - FS_CRYPTO_BLOCK_SIZE - 1, \
-			     FS_CRYPTO_BLOCK_SIZE))
-#define LLCRYPT_FNAME_MAX_UNDIGESTED_SIZE	32
-
 /**
  * ll_fname_disk_to_usr() - overlay to fscrypt_fname_disk_to_usr
  * @inode: the inode to convert name
@@ -359,7 +355,7 @@ int ll_fname_disk_to_usr(struct inode *inode,
 			lltr.name = buf;
 			lltr.len = len;
 		}
-		if (lltr.len > LLCRYPT_FNAME_MAX_UNDIGESTED_SIZE &&
+		if (lltr.len > FS_CRYPTO_BLOCK_SIZE * 2 &&
 		    !fscrypt_has_encryption_key(inode)) {
 			digested = 1;
 			/* Without the key for long names, set the dentry name
@@ -371,8 +367,8 @@ int ll_fname_disk_to_usr(struct inode *inode,
 				return -EINVAL;
 			digest.ldf_fid = *fid;
 			memcpy(digest.ldf_excerpt,
-			       LLCRYPT_FNAME_DIGEST(lltr.name, lltr.len),
-			       LLCRYPT_FNAME_DIGEST_SIZE);
+			       LLCRYPT_EXTRACT_DIGEST(lltr.name, lltr.len),
+			       sizeof(digest.ldf_excerpt));
 
 			lltr.name = (char *)&digest;
 			lltr.len = sizeof(digest);
@@ -440,7 +436,7 @@ int ll_revalidate_d_crypto(struct dentry *dentry, unsigned int flags)
 	.key_prefix		= "lustre:",
 	.get_context		= ll_get_context,
 	.set_context		= ll_set_context,
-	.dummy_context		= ll_dummy_context,
+	.get_dummy_context	= ll_get_dummy_context,
 	.empty_dir		= ll_empty_dir,
 	.max_namelen		= NAME_MAX,
 };
fs/lustre/llite/dir.c +1 -1
index 29d7e44..6eaac9a 100644
@@ -495,7 +495,7 @@ static int ll_dir_setdirstripe(struct dentry *dparent, struct lmv_user_md *lump,
 
 	if (ll_sbi_has_encrypt(sbi) &&
 	    (IS_ENCRYPTED(parent) ||
-	     unlikely(fscrypt_dummy_context_enabled(parent)))) {
+	     unlikely(ll_sb_has_test_dummy_encryption(parent->i_sb)))) {
 		err = fscrypt_get_encryption_info(parent);
 		if (err)
 			goto out_op_data;
fs/lustre/llite/llite_internal.h +1 -1
index 426c797..b052e82 100644
@@ -1726,7 +1726,7 @@ static inline struct pcc_super *ll_info2pccs(struct ll_inode_info *lli)
  */
 struct ll_digest_filename {
 	struct lu_fid ldf_fid;
-	char ldf_excerpt[LLCRYPT_FNAME_DIGEST_SIZE];
+	char ldf_excerpt[FS_CRYPTO_BLOCK_SIZE];
 };
 
 int ll_setup_filename(struct inode *dir, const struct qstr *iname,
fs/lustre/llite/llite_lib.c +27 -6
index 99ab9ac..aaff3fa 100644
@@ -474,7 +474,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt)
 		set_bit(LL_SBI_FILE_SECCTX, sbi->ll_flags);
 
 	if (ll_sbi_has_encrypt(sbi) && !obd_connect_has_enc(data)) {
-		if (ll_sbi_has_test_dummy_encryption(sbi))
+		if (ll_sb_has_test_dummy_encryption(sb))
 			LCONSOLE_WARN("%s: server %s does not support encryption feature, encryption deactivated.\n",
 				      sbi->ll_fsname,
 				      sbi->ll_md_exp->exp_obd->obd_name);
@@ -571,11 +571,11 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt)
 
 	if (ll_sbi_has_encrypt(sbi) &&
 	    !obd_connect_has_enc(&sbi->ll_dt_obd->u.lov.lov_ocd)) {
-		if (ll_sbi_has_test_dummy_encryption(sbi))
+		if (ll_sb_has_test_dummy_encryption(sb))
 			LCONSOLE_WARN("%s: server %s does not support encryption feature, encryption deactivated.\n",
 				      sbi->ll_fsname, dt);
 		ll_sbi_set_encrypt(sbi, false);
-	} else if (ll_sbi_has_test_dummy_encryption(sbi)) {
+	} else if (ll_sb_has_test_dummy_encryption(sb)) {
 		LCONSOLE_WARN("Test dummy encryption mode enabled\n");
 	}
 
@@ -909,6 +909,7 @@ void ll_kill_super(struct super_block *sb)
 	{LL_SBI_VERBOSE,		"verbose"},
 	{LL_SBI_VERBOSE,		"noverbose"},
 	{LL_SBI_ALWAYS_PING,		"always_ping"},
+	{LL_SBI_TEST_DUMMY_ENCRYPTION,	"test_dummy_encryption=%s"},
 	{LL_SBI_TEST_DUMMY_ENCRYPTION,	"test_dummy_encryption"},
 	{LL_SBI_ENCRYPT,		"encrypt"},
 	{LL_SBI_ENCRYPT,		"noencrypt"},
@@ -957,6 +958,7 @@ static int ll_options(char *options, struct super_block *sb)
 {
 	struct ll_sb_info *sbi = ll_s2sbi(sb);
 	char *s2, *s1, *opts;
+	int err = 0;
 
 	if (!options)
 		return 0;
@@ -1038,7 +1040,22 @@ static int ll_options(char *options, struct super_block *sb)
 			break;
 		case LL_SBI_TEST_DUMMY_ENCRYPTION: {
 #ifdef CONFIG_FS_ENCRYPTION
-			set_bit(token, sbi->ll_flags);
+			struct lustre_sb_info *lsi = s2lsi(sb);
+
+			err = fscrypt_set_test_dummy_encryption(sb, &args[0],
+								&lsi->lsi_dummy_enc_ctx);
+			if (!err)
+				break;
+
+			if (err == -EEXIST)
+				LCONSOLE_WARN("Can't change test_dummy_encryption");
+			else if (err == -EINVAL)
+				LCONSOLE_WARN("Value of option \"%s\" unrecognized",
+					      options);
+			else
+				LCONSOLE_WARN("Error processing option \"%s\" [%d]",
+					      options, err);
+			err = -1;
 #else
 			LCONSOLE_WARN("Test dummy encryption mount option ignored: encryption not supported\n");
 #endif
@@ -1094,7 +1111,7 @@ static int ll_options(char *options, struct super_block *sb)
 		}
 	}
 	kfree(opts);
-	return 0;
+	return err;
 }
 
 void ll_lli_init(struct ll_inode_info *lli)
@@ -1369,6 +1386,7 @@ void ll_put_super(struct super_block *sb)
 	if (profilenm)
 		class_del_profile(profilenm);
 
+	fscrypt_free_dummy_context(&lsi->lsi_dummy_enc_ctx);
 	ll_free_sbi(sb);
 	lsi->lsi_llsbi = NULL;
 
@@ -3236,9 +3254,10 @@ struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data,
 			op_data->op_bias = MDS_FID_OP;
 		}
 		if (fname.disk_name.name &&
-		    fname.disk_name.name != (unsigned char *)name)
+		    fname.disk_name.name != (unsigned char *)name) {
 			/* op_data->op_name must be freed after use */
 			op_data->op_flags |= MF_OPNAME_KMALLOCED;
+		}
 	}
 
 	/* In fact LUSTRE_OPC_LOOKUP, LUSTRE_OPC_OPEN
@@ -3317,6 +3336,8 @@ int ll_show_options(struct seq_file *seq, struct dentry *dentry)
 		}
 	}
 
+	fscrypt_show_test_dummy_encryption(seq, ',', dentry->d_sb);
+
 	return 0;
 }
 
fs/lustre/llite/namei.c +2 -1
index f7e900d..cc7b243 100644
@@ -1581,7 +1581,8 @@ static int ll_new_node(struct inode *dir, struct dentry *dchild,
 	if (ll_sbi_has_encrypt(sbi) &&
 	    ((IS_ENCRYPTED(dir) &&
 	    (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode))) ||
-	    (unlikely(fscrypt_dummy_context_enabled(dir)) && S_ISDIR(mode)))) {
+	    (unlikely(ll_sb_has_test_dummy_encryption(dir->i_sb)) &&
+	     S_ISDIR(mode)))) {
 		err = fscrypt_get_encryption_info(dir);
 		if (err)
 			goto err_exit;
Signature · 1 line
1.8.3.1
#7 lore raw

PATCH 7/28 lustre: lmv: try another MDT if statfs failed

In reply to James Simmons

From: Alexander Boyko <[email protected]>

With lazystatfs option statfs could fail if MDT0 is offline. This leads to MPICH->IOR fail during FOFB tests. A client could get statfs data from different MDT at DNE setup.

HPE-bug-id: LUS-10581
WC-bug-id: https://jira.whamcloud.com/browse/LU-15788
Lustre-commit: 57f3262baa7d89311 ("LU-15788 lmv: try another MDT if statfs failed")

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

---
 fs/lustre/lmv/lmv_obd.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
fs/lustre/lmv/lmv_obd.c +9 -2
index d83ba41ff..3af7a53 100644
@@ -1233,6 +1233,7 @@ static int lmv_statfs(const struct lu_env *env, struct obd_export *exp,
 	u32 i;
 	u32 idx;
 	int rc = 0;
+	int err = 0;
 
 	temp = kzalloc(sizeof(*temp), GFP_NOFS);
 	if (!temp)
@@ -1252,6 +1253,10 @@ static int lmv_statfs(const struct lu_env *env, struct obd_export *exp,
 		if (rc) {
 			CERROR("%s: can't stat MDS #%d: rc = %d\n",
 			       tgt->ltd_exp->exp_obd->obd_name, i, rc);
+			err = rc;
+			/* Try another MDT */
+			if (flags & OBD_STATFS_SUM)
+				continue;
 			goto out_free_temp;
 		}
 
@@ -1266,7 +1271,7 @@ static int lmv_statfs(const struct lu_env *env, struct obd_export *exp,
 			 * service
 			 */
 			*osfs = *temp;
-			break;
+			goto out_free_temp;
 		}
 
 		if (i == 0) {
@@ -1279,7 +1284,9 @@ static int lmv_statfs(const struct lu_env *env, struct obd_export *exp,
 			osfs->os_granted += temp->os_granted;
 		}
 	}
-
+	/* There is no stats from some MDTs, data incomplete */
+	if (err)
+		rc = err;
 out_free_temp:
 	kfree(temp);
 	return rc;
Signature · 1 line
1.8.3.1
#8 lore raw

PATCH 8/28 lustre: ec: add necessary structure member for EC file

In reply to James Simmons

From: Bobi Jam <[email protected]>

Added basic structure members for erasure-coding layout.

WC-bug-id: https://jira.whamcloud.com/browse/LU-12186
Lustre-commit: 4c4790088995fa690 ("LU-12186 ec: add necessary structure member for EC file")

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

---
 fs/lustre/ptlrpc/pack_generic.c         |  4 ++++
 fs/lustre/ptlrpc/wiretest.c             | 24 ++++++++++++++++++++----
 include/uapi/linux/lustre/lustre_user.h | 20 +++++++++++++++++---
 3 files changed, 41 insertions(+), 7 deletions(-)
fs/lustre/ptlrpc/pack_generic.c +4 -0
index f075188e..9acea24 100644
@@ -2129,8 +2129,10 @@ void lustre_swab_lov_comp_md_v1(struct lov_comp_md_v1 *lum)
 	__swab16s(&lum->lcm_flags);
 	__swab16s(&lum->lcm_entry_count);
 	__swab16s(&lum->lcm_mirror_count);
+	/* no need to swab lcm_ec_count */
 	BUILD_BUG_ON(offsetof(typeof(*lum), lcm_padding1) == 0);
 	BUILD_BUG_ON(offsetof(typeof(*lum), lcm_padding2) == 0);
+	BUILD_BUG_ON(offsetof(typeof(*lum), lcm_padding3) == 0);
 
 	for (i = 0; i < ent_count; i++) {
 		struct lov_user_md_v1 *v1;
@@ -2153,6 +2155,8 @@ void lustre_swab_lov_comp_md_v1(struct lov_comp_md_v1 *lum)
 		__swab32s(&ent->lcme_offset);
 		__swab32s(&ent->lcme_size);
 		__swab32s(&ent->lcme_layout_gen);
+		/* no need to swab lcme_dstripe_count */
+		/* no need to swab lcme_cstripe_count */
 		BUILD_BUG_ON(offsetof(typeof(*ent), lcme_padding_1) == 0);
 
 		v1 = (struct lov_user_md_v1 *)((char *)lum + off);
fs/lustre/ptlrpc/wiretest.c +20 -4
index 687a54d..81e0485 100644
@@ -1654,9 +1654,17 @@ void lustre_assert_wire_constants(void)
 		 (long long)(int)offsetof(struct lov_comp_md_entry_v1, lcme_timestamp));
 	LASSERTF((int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_timestamp) == 8, "found %lld\n",
 		 (long long)(int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_timestamp));
-	LASSERTF((int)offsetof(struct lov_comp_md_entry_v1, lcme_padding_1) == 44, "found %lld\n",
+	LASSERTF((int)offsetof(struct lov_comp_md_entry_v1, lcme_dstripe_count) == 44, "found %lld\n",
+		 (long long)(int)offsetof(struct lov_comp_md_entry_v1, lcme_dstripe_count));
+	LASSERTF((int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_dstripe_count) == 1, "found %lld\n",
+		 (long long)(int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_dstripe_count));
+	LASSERTF((int)offsetof(struct lov_comp_md_entry_v1, lcme_cstripe_count) == 45, "found %lld\n",
+		 (long long)(int)offsetof(struct lov_comp_md_entry_v1, lcme_cstripe_count));
+	LASSERTF((int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_cstripe_count) == 1, "found %lld\n",
+		 (long long)(int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_cstripe_count));
+	LASSERTF((int)offsetof(struct lov_comp_md_entry_v1, lcme_padding_1) == 46, "found %lld\n",
 		 (long long)(int)offsetof(struct lov_comp_md_entry_v1, lcme_padding_1));
-	LASSERTF((int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_padding_1) == 4, "found %lld\n",
+	LASSERTF((int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_padding_1) == 2, "found %lld\n",
 		 (long long)(int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_padding_1));
 	BUILD_BUG_ON(LCME_FL_STALE != 0x00000001);
 	BUILD_BUG_ON(LCME_FL_PREF_RD != 0x00000002);
@@ -1695,9 +1703,17 @@ void lustre_assert_wire_constants(void)
 		 (long long)(int)offsetof(struct lov_comp_md_v1, lcm_mirror_count));
 	LASSERTF((int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_mirror_count) == 2, "found %lld\n",
 		 (long long)(int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_mirror_count));
-	LASSERTF((int)offsetof(struct lov_comp_md_v1, lcm_padding1) == 18, "found %lld\n",
+	LASSERTF((int)offsetof(struct lov_comp_md_v1, lcm_ec_count) == 18, "found %lld\n",
+		 (long long)(int)offsetof(struct lov_comp_md_v1, lcm_ec_count));
+	LASSERTF((int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_ec_count) == 1, "found %lld\n",
+		 (long long)(int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_ec_count));
+	LASSERTF((int)offsetof(struct lov_comp_md_v1, lcm_padding3) == 19, "found %lld\n",
+		 (long long)(int)offsetof(struct lov_comp_md_v1, lcm_padding3));
+	LASSERTF((int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_padding3) == 1, "found %lld\n",
+		 (long long)(int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_padding3));
+	LASSERTF((int)offsetof(struct lov_comp_md_v1, lcm_padding1) == 20, "found %lld\n",
 		 (long long)(int)offsetof(struct lov_comp_md_v1, lcm_padding1));
-	LASSERTF((int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_padding1) == 6, "found %lld\n",
+	LASSERTF((int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_padding1) == 4, "found %lld\n",
 		 (long long)(int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_padding1));
 	LASSERTF((int)offsetof(struct lov_comp_md_v1, lcm_padding2) == 24, "found %lld\n",
 		 (long long)(int)offsetof(struct lov_comp_md_v1, lcm_padding2));
include/uapi/linux/lustre/lustre_user.h +17 -3
index fa01c28..ee789f2 100644
@@ -564,6 +564,7 @@ enum lov_comp_md_entry_flags {
 	LCME_FL_INIT		= 0x00000010,	/* instantiated */
 	LCME_FL_NOSYNC		= 0x00000020,	/* FLR: no sync for the mirror */
 	LCME_FL_EXTENSION	= 0x00000040,	/* extension comp, never init */
+	LCME_FL_PARITY		= 0x00000080,	/* EC: a parity code component */
 	LCME_FL_NEG		= 0x80000000,	/* used to indicate a negative
 						 * flag, won't be stored on disk
 						 */
@@ -596,14 +597,24 @@ enum lcme_id {
 struct lov_comp_md_entry_v1 {
 	__u32			lcme_id;	/* unique id of component */
 	__u32			lcme_flags;	/* LCME_FL_XXX */
-	struct lu_extent	lcme_extent;	/* file extent for component */
+	/* file extent for component. If it's an EC code component, its flags
+	 * contains LCME_FL_PARITY, and its extent covers the same extent of
+	 * its corresponding data component.
+	 */
+	struct lu_extent	lcme_extent;
 	__u32			lcme_offset;	/* offset of component blob,
 						 * start from lov_comp_md_v1
 						 */
 	__u32			lcme_size;	/* size of component blob */
 	__u32			lcme_layout_gen;
 	__u64			lcme_timestamp;	/* snapshot time if applicable*/
-	__u32			lcme_padding_1;
+	__u8			lcme_dstripe_count;	/* data stripe count,
+							 * k value in EC
+							 */
+	__u8			lcme_cstripe_count;	/* code stripe count,
+							 * p value in EC
+							 */
+	__u16			lcme_padding_1;
 } __attribute__((packed));
 
 #define SEQ_ID_MAX		0x0000FFFF
@@ -645,7 +656,10 @@ struct lov_comp_md_v1 {
 	 * so that non-flr files will have value 0 meaning 1 mirror.
 	 */
 	__u16	lcm_mirror_count;
-	__u16	lcm_padding1[3];
+	/* code components count, non-EC file contains 0 ec_count */
+	__u8	lcm_ec_count;
+	__u8	lcm_padding3[1];
+	__u16	lcm_padding1[2];
 	__u64	lcm_padding2;
 	struct lov_comp_md_entry_v1 lcm_entries[0];
 } __attribute__((packed));
Signature · 1 line
1.8.3.1
#9 lore raw

PATCH 9/28 lustre: llite: add option to disable Lustre inode cache

In reply to James Simmons

From: Lai Siyao <[email protected]>

A tunable option is added to disable Lustre inode cache:
"llite.*.inode_cache=0" (default =1)

When it's turned off, ll_drop_inode() always returns 1, then the last iput() will release inode.

WC-bug-id: https://jira.whamcloud.com/browse/LU-13970
Lustre-commit: 4aae212bb2aa980be ("LU-13970 llite: add option to disable Lustre inode cache")

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

---
 fs/lustre/llite/llite_internal.h |  3 ++-
 fs/lustre/llite/llite_lib.c      |  1 +
 fs/lustre/llite/lproc_llite.c    | 31 +++++++++++++++++++++++++++++++
 fs/lustre/llite/super25.c        |  7 ++++++-
 4 files changed, 40 insertions(+), 2 deletions(-)
fs/lustre/llite/llite_internal.h +2 -1
index b052e82..70a42d4 100644
@@ -676,7 +676,8 @@ struct ll_sb_info {
 	unsigned int		ll_xattr_cache_enabled:1,
 				ll_xattr_cache_set:1, /* already set to 0/1 */
 				ll_client_common_fill_super_succeeded:1,
-				ll_checksum_set:1;
+				ll_checksum_set:1,
+				ll_inode_cache_enabled:1;
 
 	struct lustre_client_ocd ll_lco;
 
fs/lustre/llite/llite_lib.c +1 -0
index aaff3fa..6adbf10 100644
@@ -445,6 +445,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt)
 	sb->s_blocksize_bits = log2(osfs->os_bsize);
 	sb->s_magic = LL_SUPER_MAGIC;
 	sb->s_maxbytes = MAX_LFS_FILESIZE;
+	sbi->ll_inode_cache_enabled = 1;
 	sbi->ll_namelen = osfs->os_namelen;
 	sbi->ll_mnt.mnt = current->fs->root.mnt;
 	sbi->ll_mnt_ns = current->nsproxy->mnt_ns;
fs/lustre/llite/lproc_llite.c +31 -0
index ce715b4..095b696 100644
@@ -1480,6 +1480,36 @@ static ssize_t opencache_max_ms_store(struct kobject *kobj,
 }
 LUSTRE_RW_ATTR(opencache_max_ms);
 
+static ssize_t inode_cache_show(struct kobject *kobj,
+				struct attribute *attr,
+				char *buf)
+{
+	struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+					      ll_kset.kobj);
+
+	return snprintf(buf, PAGE_SIZE, "%u\n", sbi->ll_inode_cache_enabled);
+}
+
+static ssize_t inode_cache_store(struct kobject *kobj,
+				 struct attribute *attr,
+				 const char *buffer,
+				 size_t count)
+{
+	struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+					      ll_kset.kobj);
+	bool val;
+	int rc;
+
+	rc = kstrtobool(buffer, &val);
+	if (rc)
+		return rc;
+
+	sbi->ll_inode_cache_enabled = val;
+
+	return count;
+}
+LUSTRE_RW_ATTR(inode_cache);
+
 static int ll_unstable_stats_seq_show(struct seq_file *m, void *v)
 {
 	struct super_block *sb = m->private;
@@ -1704,6 +1734,7 @@ struct ldebugfs_vars lprocfs_llite_obd_vars[] = {
 	&lustre_attr_opencache_threshold_count.attr,
 	&lustre_attr_opencache_threshold_ms.attr,
 	&lustre_attr_opencache_max_ms.attr,
+	&lustre_attr_inode_cache.attr,
 	NULL,
 };
 
fs/lustre/llite/super25.c +6 -1
index f50c23a..5349a25 100644
@@ -74,8 +74,13 @@ static void ll_destroy_inode(struct inode *inode)
 
 static int ll_drop_inode(struct inode *inode)
 {
-	int drop = generic_drop_inode(inode);
+	struct ll_sb_info *sbi = ll_i2sbi(inode);
+	int drop;
 
+	if (!sbi->ll_inode_cache_enabled)
+		return 1;
+
+	drop = generic_drop_inode(inode);
 	if (!drop)
 		drop = fscrypt_drop_inode(inode);
 
Signature · 1 line
1.8.3.1
#10 lore raw

PATCH 10/28 lnet: o2iblnd: clean up zombie connections on shutdown

In reply to James Simmons

From: Serguei Smirnov <[email protected]>

Clean up zombie connections on net shutdown in o2iblnd Wake up connd threads and wait for them to do the clean-up before proceeding.

WC-bug-id: https://jira.whamcloud.com/browse/LU-14503
Lustre-commit: 2a183829cdcc7008f ("LU-14503 o2iblnd: clean up zombie connections on shutdown")

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

---
 net/lnet/klnds/o2iblnd/o2iblnd.c | 6 ++++++
 1 file changed, 6 insertions(+)
net/lnet/klnds/o2iblnd/o2iblnd.c +6 -0
index 8dce4179..65bc89b 100644
@@ -2609,6 +2609,12 @@ static void kiblnd_shutdown(struct lnet_ni *ni)
 		list_del(&net->ibn_list);
 		write_unlock_irqrestore(g_lock, flags);
 
+		wake_up_all(&kiblnd_data.kib_connd_waitq);
+		wait_var_event_warning(&net->ibn_nconns,
+				       atomic_read(&net->ibn_nconns) == 0,
+				       "%s: waiting for %d conns to clean\n",
+				       libcfs_nidstr(&ni->ni_nid),
+				       atomic_read(&net->ibn_nconns));
 		/* fall through */
 
 	case IBLND_INIT_NOTHING:
Signature · 1 line
1.8.3.1
#11 lore raw

PATCH 11/28 lustre: ptlrpc: Rearrange version mismatch message

In reply to James Simmons

From: Andrew Elwell <[email protected]>

Minor change to reposition the client version string on console warning message.

WC-bug-id: https://jira.whamcloud.com/browse/LU-14771
Lustre-commit: 8a35a977b4322db56 ("LU-14771 ptlrpc: Rearrange version mismatch message")

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

---
 fs/lustre/ptlrpc/import.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/lustre/ptlrpc/import.c +3 -2
index c0aee34..d685b96 100644
@@ -853,14 +853,15 @@ static int ptlrpc_connect_set_flags(struct obd_import *imp,
 		const char *older = "older than client. Consider upgrading server";
 		const char *newer = "newer than client. Consider upgrading client";
 
-		LCONSOLE_WARN("Server %s version (%d.%d.%d.%d) is much %s (%s)\n",
+		LCONSOLE_WARN("Client version (%s). Server %s version (%d.%d.%d.%d) is much %s\n",
+			      LUSTRE_VERSION_STRING,
 			      obd2cli_tgt(imp->imp_obd),
 			      OBD_OCD_VERSION_MAJOR(ocd->ocd_version),
 			      OBD_OCD_VERSION_MINOR(ocd->ocd_version),
 			      OBD_OCD_VERSION_PATCH(ocd->ocd_version),
 			      OBD_OCD_VERSION_FIX(ocd->ocd_version),
 			      ocd->ocd_version > LUSTRE_VERSION_CODE ?
-			      newer : older, LUSTRE_VERSION_STRING);
+			      newer : older);
 		warned = true;
 	}
 
Signature · 1 line
1.8.3.1
#12 lore raw

PATCH 12/28 lustre: llite: Correct cl_env comments

In reply to James Simmons

From: Patrick Farrell <[email protected]>

The comments related to cl_env caching behavior are dangerously out of date and misleading, describing an old caching mechanism which was linked to threads.

This has not been present for some time, and we cannot use cl_env_get to get the environment for a thread as it describes.

Correct the various comments and remove a now extraneous include.

Fixes a763e916d8 ("staging/lustre: Get rid of cl_env hash table")

WC-bug-id: https://jira.whamcloud.com/browse/LU-14832
Lustre-commit: c6d1f8aacafe67510 ("LU-14832 llite: Correct cl_env comments")

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

---
 fs/lustre/obdclass/cl_object.c | 32 ++++++++++++--------------------
 1 file changed, 12 insertions(+), 20 deletions(-)
fs/lustre/obdclass/cl_object.c +12 -20
index c5deb5c..6f87160 100644
@@ -532,21 +532,6 @@ int cl_site_stats_print(const struct cl_site *site, struct seq_file *m)
  *
  */
 
-/**
- * The most efficient way is to store cl_env pointer in task specific
- * structures. On Linux, it isn't easy to use task_struct->journal_info
- * because Lustre code may call into other fs during memory reclaim, which
- * has certain assumptions about journal_info. There are not currently any
- * fields in task_struct that can be used for this purpose.
- * \note As long as we use task_struct to store cl_env, we assume that once
- * called into Lustre, we'll never call into the other part of the kernel
- * which will use those fields in task_struct without explicitly exiting
- * Lustre.
- *
- * Since there's no space in task_struct is available, hash will be used.
- * bz20044, bz22683.
- */
-
 static unsigned int cl_envs_cached_max = 32; /* XXX: prototype: arbitrary limit
 					      * for now.
 					      */
@@ -628,6 +613,9 @@ static void cl_env_fini(struct cl_env *cle)
 	kmem_cache_free(cl_env_kmem, cle);
 }
 
+/* Get a cl_env, either from the per-CPU cache for the current CPU, or by
+ * allocating a new one.
+ */
 static struct lu_env *cl_env_obtain(void *debug)
 {
 	struct cl_env *cle;
@@ -672,10 +660,14 @@ static inline struct cl_env *cl_env_container(struct lu_env *env)
 }
 
 /**
- * Returns lu_env: if there already is an environment associated with the
- * current thread, it is returned, otherwise, new environment is allocated.
+ * Returns an lu_env.
+ *
+ * No link to thread, this returns an env from the cache or
+ * allocates a new one.
  *
- * Allocations are amortized through the global cache of environments.
+ * If you need to get the specific environment you created for this thread,
+ * you must either pass the pointer directly or store it in the file/inode
+ * private data and retrieve it from there using ll_cl_add/ll_cl_find.
  *
  * @refcheck pointer to a counter used to detect environment leaks. In
  * the usual case cl_env_get() and cl_env_put() are called in the same lexical
@@ -765,8 +757,8 @@ unsigned int cl_env_cache_purge(unsigned int nr)
  * Release an environment.
  *
  * Decrement @env reference counter. When counter drops to 0, nothing in
- * this thread is using environment and it is returned to the allocation
- * cache, or freed straight away, if cache is large enough.
+ * this thread is using environment and it is returned to the per-CPU cache or
+ * freed immediately if the cache is full.
  */
 void cl_env_put(struct lu_env *env, u16 *refcheck)
 {
Signature · 1 line
1.8.3.1
#13 lore raw

PATCH 13/28 lnet: set max recovery interval duration

In reply to James Simmons

From: Cyril Bordage <[email protected]>

Add a tunable parameter to limit the recovery ping interval which was previously statically set to 900.
This can be done by using:

lnetctl set max_recovery_ping_interval <value>

WC-bug-id: https://jira.whamcloud.com/browse/LU-14979
Lustre-commit: 4027395fe463b6ea1 ("LU-14979 lnet: set max recovery interval duration")

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

---
 include/linux/lnet/lib-lnet.h |  9 ++++----
 net/lnet/lnet/api-ni.c        | 49 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 4 deletions(-)
include/linux/lnet/lib-lnet.h +5 -4
index ceb12b1..e21866b 100644
@@ -559,6 +559,8 @@ unsigned int lnet_nid_cpt_hash(struct lnet_nid *nid,
 extern unsigned int lnet_recovery_limit;
 extern unsigned int lnet_peer_discovery_disabled;
 extern unsigned int lnet_drop_asym_route;
+extern unsigned int lnet_max_recovery_ping_interval;
+extern unsigned int lnet_max_recovery_ping_count;
 extern unsigned int router_sensitivity_percentage;
 extern int alive_router_check_interval;
 extern int live_router_check_interval;
@@ -1009,15 +1011,14 @@ int lnet_get_peer_ni_info(u32 peer_index, u64 *nid,
 	return false;
 }
 
-#define LNET_RECOVERY_INTERVAL_MAX 900
 static inline unsigned int
 lnet_get_next_recovery_ping(unsigned int ping_count, time64_t now)
 {
 	unsigned int interval;
 
-	/* 2^9 = 512, 2^10 = 1024 */
-	if (ping_count > 9)
-		interval = LNET_RECOVERY_INTERVAL_MAX;
+	/* lnet_max_recovery_interval <= 2^lnet_max_recovery_ping_count */
+	if (ping_count > lnet_max_recovery_ping_count)
+		interval = lnet_max_recovery_ping_interval;
 	else
 		interval = 1 << ping_count;
 
net/lnet/lnet/api-ni.c +49 -0

61 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#14 lore raw

PATCH 14/28 lnet: libcfs: reset hs_rehash_bits

In reply to James Simmons

From: Alex Zhuravlev <[email protected]>

if rehash work is cancelled, then nobody resets
hs_rehash_bits and the first iterator asserts
at LASSERT(!cfs_hash_is_rehashing(hs)) in
cfs_hash_for_each_relax().

WC-bug-id: https://jira.whamcloud.com/browse/LU-15207
Lustre-commit: 9257f24dfdf9f0a68 ("LU-15207 libcfs: reset hs_rehash_bits")

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

---
 net/lnet/libcfs/hash.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
net/lnet/libcfs/hash.c +9 -2
index d060eaa..c9ff92d 100644
@@ -1765,8 +1765,15 @@ struct cfs_hash_cond_arg {
 void
 cfs_hash_rehash_cancel(struct cfs_hash *hs)
 {
-	LASSERT(cfs_hash_with_rehash(hs));
-	cancel_work_sync(&hs->hs_rehash_work);
+	LASSERT(hs->hs_iterators > 0 || hs->hs_exiting);
+	while (cfs_hash_is_rehashing(hs)) {
+		if (cancel_work_sync(&hs->hs_rehash_work)) {
+			cfs_hash_lock(hs, 1);
+			hs->hs_rehash_bits = 0;
+			cfs_hash_unlock(hs, 1);
+		}
+		cond_resched();
+	}
 }
 
 void
Signature · 1 line
1.8.3.1
#15 lore raw

PATCH 15/28 lustre: llite: Make iotrace logging quieter

In reply to James Simmons

From: Patrick Farrell <[email protected]>

Most of the time, we don't read any pages with readahead, since we're moving through the window and aren't ready to read more yet. That's important for readahead debug, but there's no need to log it for iotrace. (This matters because without this change, this message is the large majority of iotrace messages.)

WC-bug-id: https://jira.whamcloud.com/browse/LU-15317
Lustre-commit: a91b5d4a990c6a870 ("LU-15317 llite: Make iotrace logging quieter")

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

---
 fs/lustre/llite/rw.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/lustre/llite/rw.c +4 -1
index bd02a28..239f78b 100644
@@ -1692,7 +1692,10 @@ int ll_io_read_page(const struct lu_env *env, struct cl_io *io,
 		rc2 = ll_readahead(env, io, &queue->c2_qin, ras,
 				   uptodate, file, skip_index,
 				   &ra_start_index);
-		CDEBUG(D_READA|D_IOTRACE,
+		/* to keep iotrace clean, we only print here if we actually
+		 * read pages
+		 */
+		CDEBUG(D_READA | (rc2 ? D_IOTRACE : 0),
 		       DFID " %d pages read ahead at %lu, triggered by user read at %lu\n",
 		       PFID(ll_inode2fid(inode)), rc2, ra_start_index,
 		       vvp_index(vpg));
Signature · 1 line
1.8.3.1
#16 lore raw

PATCH 16/28 lustre: llite: Add strided readahead to iotrace

In reply to James Simmons

From: Patrick Farrell <[email protected]>

We need to capture some additional parameters to correctly understand the behavior of strided readahead. Add these parameters to the existing iotrace message.

WC-bug-id: https://jira.whamcloud.com/browse/LU-15317
Lustre-commit: 5ed185955985b099b ("LU-15317 llite: Add strided readahead to iotrace")

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

---
 fs/lustre/llite/rw.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
fs/lustre/llite/rw.c +4 -2
index 239f78b..1c2f027 100644
@@ -1696,9 +1696,11 @@ int ll_io_read_page(const struct lu_env *env, struct cl_io *io,
 		 * read pages
 		 */
 		CDEBUG(D_READA | (rc2 ? D_IOTRACE : 0),
-		       DFID " %d pages read ahead at %lu, triggered by user read at %lu\n",
+		       DFID " %d pages read ahead at %lu, triggered by user read at %lu, stride offset %lld, stride length %lld, stride bytes %lld\n",
 		       PFID(ll_inode2fid(inode)), rc2, ra_start_index,
-		       vvp_index(vpg));
+		       vvp_index(vpg), ras->ras_stride_offset,
+		       ras->ras_stride_length, ras->ras_stride_bytes);
+
 	} else if (vvp_index(vpg) == io_start_index &&
 		   io_end_index - io_start_index > 0) {
 		rc2 = ll_readpages(env, io, &queue->c2_qin, io_start_index + 1,
Signature · 1 line
1.8.3.1
#17 lore raw

PATCH 17/28 lustre: llite: Add FID to async ra iotrace

In reply to James Simmons

From: Patrick Farrell <[email protected]>

IOtrace log entries need to include the FID of the file concerned. Add this to async readahead.

WC-bug-id: https://jira.whamcloud.com/browse/LU-15317
Lustre-commit: 1f3ecfdbb4c765808 ("LU-15317 llite: Add FID to async ra iotrace")

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

---
 fs/lustre/llite/rw.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/lustre/llite/rw.c +3 -3
index 1c2f027..c807217 100644
@@ -596,9 +596,9 @@ static void ll_readahead_handle_work(struct work_struct *wq)
 	sbi = ll_i2sbi(inode);
 
 	CDEBUG(D_READA|D_IOTRACE,
-	       "%s: async ra from %lu to %lu triggered by user pid %d\n",
-	       file_dentry(file)->d_name.name, work->lrw_start_idx,
-	       work->lrw_end_idx, work->lrw_user_pid);
+	       "%s:"DFID": async ra from %lu to %lu triggered by user pid %d\n",
+	       file_dentry(file)->d_name.name, PFID(ll_inode2fid(inode)),
+	       work->lrw_start_idx, work->lrw_end_idx, work->lrw_user_pid);
 
 	env = cl_env_alloc(&refcheck, LCT_NOREF);
 	if (IS_ERR(env)) {
Signature · 1 line
1.8.3.1
#18 lore raw

PATCH 18/28 lustre: llite: Add COMPLETED iotrace messages

In reply to James Simmons

From: Patrick Farrell <[email protected]>

It's very useful to see how long an I/O call took. There are other ways to do this, but the goal is for iotrace to provide all necessary information for basic I/O performance analysis, so we add COMPLETED messages to iotrace.

WC-bug-id: https://jira.whamcloud.com/browse/LU-15317
Lustre-commit: d48b10cef36d74cc6 ("LU-15317 llite: Add COMPLETED iotrace messages")

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

---
 fs/lustre/llite/file.c       | 12 ++++++++++++
 fs/lustre/llite/llite_mmap.c | 12 +++++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)
fs/lustre/llite/file.c +12 -0
index 5be77e8..efe117d 100644
@@ -2013,6 +2013,12 @@ static ssize_t ll_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
 				   ktime_us_delta(ktime_get(), kstart));
 	}
 
+	CDEBUG(D_IOTRACE,
+	       "COMPLETED: file %s:"DFID", ppos: %lld, count: %zu\n",
+	       file_dentry(file)->d_name.name,
+	       PFID(ll_inode2fid(file_inode(file))), iocb->ki_pos,
+	       iov_iter_count(to));
+
 	return result;
 }
 
@@ -2158,6 +2164,12 @@ static ssize_t ll_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
 				   ktime_us_delta(ktime_get(), kstart));
 	}
 
+	CDEBUG(D_IOTRACE,
+	       "COMPLETED: file %s:"DFID", ppos: %lld, count: %zu\n",
+	       file_dentry(file)->d_name.name,
+	       PFID(ll_inode2fid(file_inode(file))), iocb->ki_pos,
+	       iov_iter_count(from));
+
 	return rc_normal;
 }
 
fs/lustre/llite/llite_mmap.c +11 -1
index 2e762b1..4acc7ee 100644
@@ -415,7 +415,7 @@ static vm_fault_t ll_fault(struct vm_fault *vmf)
 			goto restart;
 		}
 
-		result = VM_FAULT_LOCKED;
+		result |= VM_FAULT_LOCKED;
 	}
 	sigprocmask(SIG_SETMASK, &old, NULL);
 
@@ -430,6 +430,11 @@ static vm_fault_t ll_fault(struct vm_fault *vmf)
 				   ktime_us_delta(ktime_get(), kstart));
 	}
 
+	CDEBUG(D_IOTRACE,
+	       "COMPLETED: "DFID": vma=%p start=%#lx end=%#lx vm_flags=%#lx idx=%lu\n",
+	       PFID(&ll_i2info(file_inode(vma->vm_file))->lli_fid),
+	       vma, vma->vm_start, vma->vm_end, vma->vm_flags, vmf->pgoff);
+
 	return result;
 }
 
@@ -498,6 +503,11 @@ static vm_fault_t ll_page_mkwrite(struct vm_fault *vmf)
 				   ktime_us_delta(ktime_get(), kstart));
 	}
 
+	CDEBUG(D_IOTRACE,
+	       "COMPLETED: "DFID": vma=%p start=%#lx end=%#lx vm_flags=%#lx idx=%lu\n",
+	       PFID(&ll_i2info(file_inode(vma->vm_file))->lli_fid),
+	       vma, vma->vm_start, vma->vm_end, vma->vm_flags,
+	       vmf->page->index);
 	return ret;
 }
 
Signature · 1 line
1.8.3.1
#19 lore raw

PATCH 19/28 lustre: osc: Add RPC to iotrace

In reply to James Simmons

From: Patrick Farrell <[email protected]>

Add RPCs to iotrace debugging.

To avoid creating too much debug output, this debug ignores the possiblity that an RPC contains non-contiguous extents. Thus the eventual visualization will act as though the RPC is a continuous whole. I judge this to be superior to the amount of log data and complexity of capturing each extent separately. If that level of detail is needed, a higher debug level can be used.

WC-bug-id: https://jira.whamcloud.com/browse/LU-15317
Lustre-commit: 5cb722c384077dd24 ("LU-15317 osc: Add RPC to iotrace")

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

---
 fs/lustre/osc/osc_request.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
fs/lustre/osc/osc_request.c +14 -2
index 124d3c57..d84884f 100644
@@ -2665,6 +2665,7 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli,
 
 	spin_lock(&cli->cl_loi_list_lock);
 	starting_offset >>= PAGE_SHIFT;
+	ending_offset >>= PAGE_SHIFT;
 	if (cmd == OBD_BRW_READ) {
 		cli->cl_r_in_flight++;
 		lprocfs_oh_tally_log2(&cli->cl_read_page_hist, page_count);
@@ -2681,8 +2682,19 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli,
 	spin_unlock(&cli->cl_loi_list_lock);
 
 	DEBUG_REQ(D_INODE, req, "%d pages, aa %p, now %ur/%dw in flight",
-		  page_count, aa, cli->cl_r_in_flight,
-		  cli->cl_w_in_flight);
+		  page_count, aa, cli->cl_r_in_flight, cli->cl_w_in_flight);
+	if (libcfs_debug & D_IOTRACE) {
+		struct lu_fid fid;
+
+		fid.f_seq = crattr->cra_oa->o_parent_seq;
+		fid.f_oid = crattr->cra_oa->o_parent_oid;
+		fid.f_ver = crattr->cra_oa->o_parent_ver;
+		CDEBUG(D_IOTRACE,
+		       DFID": %d %s pages, start %lld, end %lld, now %ur/%uw in flight\n",
+		       PFID(&fid), page_count,
+		       cmd == OBD_BRW_READ ? "read" : "write", starting_offset,
+		       ending_offset, cli->cl_r_in_flight, cli->cl_w_in_flight);
+	}
 	OBD_FAIL_TIMEOUT(OBD_FAIL_OSC_DELAY_IO, cfs_fail_val);
 
 	ptlrpcd_add_req(req);
Signature · 1 line
1.8.3.1
#20 lore raw

PATCH 20/28 lnet: libcfs: add "default" keyword for debug mask

In reply to James Simmons

From: Andreas Dilger <[email protected]>

Allow "lctl set_param debug=default" to reset the debug mask to the default value. This is useful if the debug needs to be set to a higher value temporarily, but should be easily reset back to the original value afterward.

WC-bug-id: https://jira.whamcloud.com/browse/LU-9859
Lustre-commit: 4c9a5762413638cc6 ("LU-9859 libcfs: add "default" keyword for debug mask")

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

---
 include/linux/libcfs/libcfs_string.h   |   3 +-
 include/uapi/linux/lnet/libcfs_debug.h | 129 +++++++++++++++++----------------
 net/lnet/libcfs/debug.c                |  11 ++-
 net/lnet/libcfs/libcfs_string.c        |  11 ++-
 4 files changed, 85 insertions(+), 69 deletions(-)
include/linux/libcfs/libcfs_string.h +2 -1
index e2b6d72..a8bd44d 100644
@@ -44,7 +44,8 @@
 /* libcfs_string.c */
 /* Convert a text string to a bitmask */
 int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),
-		 int *oldmask, int minmask, int allmask);
+		 int *oldmask, int minmask, int allmask, int defmask);
+
 /* trim leading and trailing space characters */
 char *cfs_firststr(char *str, size_t size);
 
include/uapi/linux/lnet/libcfs_debug.h +68 -61

144 lines not on this page · raw message

net/lnet/libcfs/debug.c +5 -6
index 1bb382d..f8ff5f7 100644
@@ -47,13 +47,12 @@
 
 static char debug_file_name[1024];
 
-unsigned int libcfs_subsystem_debug = ~0;
+unsigned int libcfs_subsystem_debug = LIBCFS_S_DEFAULT;
 EXPORT_SYMBOL(libcfs_subsystem_debug);
 module_param(libcfs_subsystem_debug, int, 0644);
 MODULE_PARM_DESC(libcfs_subsystem_debug, "Lustre kernel debug subsystem mask");
 
-unsigned int libcfs_debug = (D_CANTMASK |
-			     D_NETERROR | D_HA | D_CONFIG | D_IOCTL);
+unsigned int libcfs_debug = LIBCFS_D_DEFAULT;
 EXPORT_SYMBOL(libcfs_debug);
 module_param(libcfs_debug, int, 0644);
 MODULE_PARM_DESC(libcfs_debug, "Lustre kernel debug mask");
@@ -236,7 +235,7 @@ static int param_set_uintpos(const char *val, const struct kernel_param *kp)
 /* libcfs_debug_token2mask() expects the returned string in lower-case */
 static const char *libcfs_debug_subsys2str(int subsys)
 {
-	static const char * const libcfs_debug_subsystems[] =
+	static const char *const libcfs_debug_subsystems[] =
 		LIBCFS_DEBUG_SUBSYS_NAMES;
 
 	if (subsys >= ARRAY_SIZE(libcfs_debug_subsystems))
@@ -328,8 +327,8 @@ static const char *libcfs_debug_dbg2str(int debug)
 		return 0;
 	}
 
-	return cfs_str2mask(str, fn, mask, is_subsys ? 0 : D_CANTMASK,
-			    0xffffffff);
+	return cfs_str2mask(str, fn, mask, is_subsys ? 0 : D_CANTMASK, ~0,
+			    is_subsys ? LIBCFS_S_DEFAULT : LIBCFS_D_DEFAULT);
 }
 
 char lnet_debug_log_upcall[1024] = "/usr/lib/lustre/lnet_debug_log_upcall";
net/lnet/libcfs/libcfs_string.c +10 -1
index 0563c42..672b859 100644
@@ -46,7 +46,7 @@
 
 /* Convert a text string to a bitmask */
 int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),
-		 int *oldmask, int minmask, int allmask)
+		 int *oldmask, int minmask, int allmask, int defmask)
 {
 	const char *debugstr;
 	char op = '\0';
@@ -102,6 +102,15 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),
 				newmask = allmask;
 			found = 1;
 		}
+		if (!found && strcasecmp(str, "DEFAULT") == 0) {
+			if (op == '-')
+				newmask = (newmask & ~defmask) | minmask;
+			else if (op == '+')
+				newmask |= defmask;
+			else
+				newmask = defmask;
+			found = 1;
+		}
 		if (!found) {
 			CWARN("unknown mask '%.*s'.\n"
 			      "mask usage: [+|-]<all|type> ...\n", len, str);
Signature · 1 line
1.8.3.1
#21 lore raw

PATCH 21/28 lustre: uapi: avoid gcc-11 -Werror=stringop-overread warning

In reply to James Simmons

GCC 11 warns about string and memory operations on fixed address:

In function 'memcpy', inlined from 'obd_uuid2str' at lustre/include/uapi/linux/lustre/lustre_user.h:1222:3, include/linux/fortify-string.h:20:33: error: '__builtin_memcpy' reading 39 bytes from a region of size 0 [-Werror=stringop-overread]

  20 | #define __underlying_memcpy     __builtin_memcpy
     |                                 ^
include/linux/fortify-string.h:191:16: note:
in expansion of macro '__underlying_memcpy'
  191 |         return __underlying_memcpy(p, q, size);
      |                ^~~~~~~~~~~~~~~~~~~

The patch avoids the above warning by not using a fixed address.

WC-bug-id: https://jira.whamcloud.com/browse/LU-15220
Lustre-commit: c5fb44f5ecf8494cd ("LU-15220 tests: avoid gcc-11 -Werror=stringop-overread warning")

Reviewed-on: https://review.whamcloud.com/45777
WC-bug-id: https://jira.whamcloud.com/browse/LU-15420
Lustre-commit: 6331eadbd60a8c58c ("LU-15420 uapi: avoid gcc-11 -Werror=stringop-overread")

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

---
 include/uapi/linux/lustre/lustre_user.h | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
include/uapi/linux/lustre/lustre_user.h +14 -12
index ee789f2..c57929b 100644
@@ -40,26 +40,27 @@
  *
  * @{
  */
+#include <linux/string.h>
+#ifndef __KERNEL__
+# define __USE_ISOC99  1
+# include <stdbool.h>
+# include <stdio.h> /* snprintf() */
+# include <sys/stat.h>
+
+# define __USE_GNU	1
+# define FILEID_LUSTRE 0x97 /* for name_to_handle_at() (and llapi_fd2fid()) */
+#endif /* !__KERNEL__ */
 
 #include <linux/fs.h>
 #include <linux/limits.h>
 #include <linux/kernel.h>
 #include <linux/stat.h>
-#include <linux/string.h>
 #include <linux/quota.h>
 #include <linux/types.h>
 #include <linux/unistd.h>
 #include <linux/lustre/lustre_fiemap.h>
 #include <linux/lustre/lustre_ver.h>
 
-#ifndef __KERNEL__
-# define __USE_ISOC99  1
-# include <stdbool.h>
-# include <stdio.h> /* snprintf() */
-# include <sys/stat.h>
-# define FILEID_LUSTRE 0x97 /* for name_to_handle_at() (and llapi_fd2fid()) */
-#endif /* __KERNEL__ */
-
 #if defined(__cplusplus)
 extern "C" {
 #endif
@@ -937,10 +938,11 @@ static inline char *obd_uuid2str(const struct obd_uuid *uuid)
 		/* Obviously not safe, but for printfs, no real harm done...
 		 * we're always null-terminated, even in a race.
 		 */
-		static char temp[sizeof(*uuid)];
+		static char temp[sizeof(*uuid->uuid)];
+
+		memcpy(temp, uuid->uuid, sizeof(*uuid->uuid) - 1);
+		temp[sizeof(*uuid->uuid) - 1] = '\0';
 
-		memcpy(temp, uuid->uuid, sizeof(*uuid) - 1);
-		temp[sizeof(*uuid) - 1] = '\0';
 		return temp;
 	}
 	return (char *)(uuid->uuid);
Signature · 1 line
1.8.3.1
#22 lore raw

PATCH 22/28 lustre: lmv: skip qos for qos_threshold_rr=100

In reply to James Simmons

From: Alexander Boyko <[email protected]>

Current implementation of qos allocation is called for every statfs update. It takes lq_rw_sem for write and recalculate penalties, even whith setting qos_threshold_rr=100. Which means always use rr allocation. Let's skip unnecessary locking and calculation for 100% round robin allocation.

HPE-bug-id: LUS-10388
WC-bug-id: https://jira.whamcloud.com/browse/LU-15393
Lustre-commit: 2f23140d5c1396fd0 ("LU-15393 lod: skip qos for qos_threshold_rr=100")

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

---
 fs/lustre/include/lu_object.h     |  1 +
 fs/lustre/lmv/lproc_lmv.c         |  5 +++--
 fs/lustre/obdclass/lu_tgt_descs.c | 12 ++++++++----
 3 files changed, 12 insertions(+), 6 deletions(-)
fs/lustre/include/lu_object.h +1 -0
index 3fb40c6..e4dd287c5 100644
@@ -1503,6 +1503,7 @@ struct lu_tgt_desc_idx {
 };
 
 /* QoS data for LOD/LMV */
+#define QOS_THRESHOLD_MAX 256 /* should be power of two */
 struct lu_qos {
 	struct list_head	lq_svr_list;	 /* lu_svr_qos list */
 	struct rw_semaphore	lq_rw_sem;
fs/lustre/lmv/lproc_lmv.c +3 -2
index b9efae9..6d4e8d9 100644
@@ -158,7 +158,8 @@ static ssize_t qos_threshold_rr_show(struct kobject *kobj,
 					      obd_kset.kobj);
 
 	return scnprintf(buf, PAGE_SIZE, "%u%%\n",
-			(obd->u.lmv.lmv_qos.lq_threshold_rr * 100 + 255) >> 8);
+			(obd->u.lmv.lmv_qos.lq_threshold_rr * 100 +
+			(QOS_THRESHOLD_MAX - 1)) / QOS_THRESHOLD_MAX);
 }
 
 static ssize_t qos_threshold_rr_store(struct kobject *kobj,
@@ -190,7 +191,7 @@ static ssize_t qos_threshold_rr_store(struct kobject *kobj,
 	if (val > 100)
 		return -EINVAL;
 
-	lmv->lmv_qos.lq_threshold_rr = (val << 8) / 100;
+	lmv->lmv_qos.lq_threshold_rr = (val * QOS_THRESHOLD_MAX) / 100;
 	set_bit(LQ_DIRTY, &lmv->lmv_qos.lq_flags);
 
 	return count;
fs/lustre/obdclass/lu_tgt_descs.c +8 -4
index 935cff6..51d2e21 100644
@@ -275,11 +275,13 @@ int lu_tgt_descs_init(struct lu_tgt_descs *ltd, bool is_mdt)
 		ltd->ltd_lmv_desc.ld_pattern = LMV_HASH_TYPE_DEFAULT;
 		ltd->ltd_qos.lq_prio_free = LMV_QOS_DEF_PRIO_FREE * 256 / 100;
 		ltd->ltd_qos.lq_threshold_rr =
-			LMV_QOS_DEF_THRESHOLD_RR_PCT * 256 / 100;
+			LMV_QOS_DEF_THRESHOLD_RR_PCT *
+			QOS_THRESHOLD_MAX / 100;
 	} else {
 		ltd->ltd_qos.lq_prio_free = LOV_QOS_DEF_PRIO_FREE * 256 / 100;
 		ltd->ltd_qos.lq_threshold_rr =
-			LOV_QOS_DEF_THRESHOLD_RR_PCT * 256 / 100;
+			LOV_QOS_DEF_THRESHOLD_RR_PCT *
+			QOS_THRESHOLD_MAX / 100;
 	}
 
 	return 0;
@@ -568,8 +570,10 @@ int ltd_qos_penalties_calc(struct lu_tgt_descs *ltd)
 	 * creation performance
 	 */
 	clear_bit(LQ_SAME_SPACE, &qos->lq_flags);
-	if ((ba_max * (256 - qos->lq_threshold_rr)) >> 8 < ba_min &&
-	    (ia_max * (256 - qos->lq_threshold_rr)) >> 8 < ia_min) {
+	if (((ba_max * (QOS_THRESHOLD_MAX - qos->lq_threshold_rr)) /
+	    QOS_THRESHOLD_MAX) < ba_min &&
+	    ((ia_max * (QOS_THRESHOLD_MAX - qos->lq_threshold_rr)) /
+	    QOS_THRESHOLD_MAX) < ia_min) {
 		set_bit(LQ_SAME_SPACE, &qos->lq_flags);
 		/* Reset weights for the next time we enter qos mode */
 		set_bit(LQ_RESET, &qos->lq_flags);
Signature · 1 line
1.8.3.1
#23 lore raw

PATCH 23/28 lnet: Ping buffer ref leak in lnet_peer_data_present

In reply to James Simmons

From: Chris Horn <[email protected]>

lnet_peer_merge_data() and lnet_peer_set_primary_data() are responsible for dropping the reference on the ping buffer that is taken by lnet_peer_push_event() and lnet_discovery_event_reply(). However, there are some error paths in lnet_peer_data_present() where we do not call either lnet_peer_merge_data() or lnet_peer_set_primary_data(). In these cases, we need to drop the reference on the ping buffer otherwise it will leak.

HPE-bug-id: LUS-10715
WC-bug-id: https://jira.whamcloud.com/browse/LU-15509
Lustre-commit: 4de9793654ec1b2f0 ("LU-15509 lnet: Ping buffer ref leak in lnet_peer_data_present")

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

---
 net/lnet/lnet/peer.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
net/lnet/lnet/peer.c +7 -2
index 57d137c..3909c5d 100644
@@ -3317,8 +3317,10 @@ static int lnet_peer_data_present(struct lnet_peer *lp)
 	 * down, and our reference count may be all that is keeping it
 	 * alive. Don't do any work on it.
 	 */
-	if (list_empty(&lp->lp_peer_list))
+	if (list_empty(&lp->lp_peer_list)) {
+		lnet_ping_buffer_decref(pbuf);
 		goto out;
+	}
 
 	flags = LNET_PEER_DISCOVERED;
 	if (pbuf->pb_info.pi_features & LNET_PING_FEAT_MULTI_RAIL)
@@ -3345,7 +3347,9 @@ static int lnet_peer_data_present(struct lnet_peer *lp)
 	nid = pbuf->pb_info.pi_ni[1].ns_nid;
 	if (nid_is_lo0(&lp->lp_primary_nid)) {
 		rc = lnet_peer_set_primary_nid(lp, nid, flags);
-		if (!rc)
+		if (rc)
+			lnet_ping_buffer_decref(pbuf);
+		else
 			rc = lnet_peer_merge_data(lp, pbuf);
 	/* if the primary nid of the peer is present in the ping info returned
 	 * from the peer, but it's not the local primary peer we have
@@ -3367,6 +3371,7 @@ static int lnet_peer_data_present(struct lnet_peer *lp)
 				CERROR("Primary NID error %s versus %s: %d\n",
 				       libcfs_nidstr(&lp->lp_primary_nid),
 				       libcfs_nid2str(nid), rc);
+				lnet_ping_buffer_decref(pbuf);
 			} else {
 				rc = lnet_peer_merge_data(lp, pbuf);
 			}
Signature · 1 line
1.8.3.1
#24 lore raw

PATCH 24/28 lnet: DLC sets map_on_demand incorrectly

In reply to James Simmons

From: Chris Horn <[email protected]>

When any NET or LND tunable is specified via CLI or yaml, then the whole tunables struct gets memset to 0, or in the case of yaml config, 0 gets assigned to any tunable that isn't specified in the yaml. This causes a problem for map_on_demand because 0 is a valid value for that parameter, and ko2iblnd cannot know whether the user specified that 0 should be used or if DLC is specifying that the parameter was unset.

Rather than setting this parameter to 0 in the LND tunables struct, have DLC set it to UINT_MAX to indicate that ko2iblnd should use the value of the kernel module parameter.

HPE-bug-id: LUS-10740
WC-bug-id: https://jira.whamcloud.com/browse/LU-15538
Lustre-commit: 896f4a082b93453f5 ("LU-15538 lnet: DLC sets map_on_demand incorrectly")

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

---
 net/lnet/klnds/o2iblnd/o2iblnd_modparams.c | 3 +++
 1 file changed, 3 insertions(+)
net/lnet/klnds/o2iblnd/o2iblnd_modparams.c +3 -0
index 022ed02..04286e1 100644
@@ -261,6 +261,9 @@ int kiblnd_tunables_setup(struct lnet_ni *ni)
 		net_tunables->lct_peer_tx_credits =
 			net_tunables->lct_max_tx_credits;
 
+	if (tunables->lnd_map_on_demand == UINT_MAX)
+		tunables->lnd_map_on_demand = map_on_demand;
+
 	/*
 	 * For kernels which do not support global memory regions, always
 	 * enable map_on_demand
Signature · 1 line
1.8.3.1
#25 lore raw

PATCH 25/28 lnet: Return ESHUTDOWN in lnet_parse()

In reply to James Simmons

From: Chris Horn <[email protected]>

If the peer NI lookup in lnet_parse() fails with ESHUTDOWN then we should return that value back to the LNDs so that they can treat the failed call the same way as other lnet_parse() failures.

Returning zero results in at least one bug in socklnd where a reference on a ksock_conn can be leaked which prevents socklnd from shutting down.

Fixes e426f0d24e ("staging: lustre: lnet: Do not drop message when shutting down LNet")

HPE-bug-id: LUS-15794
WC-bug-id: https://jira.whamcloud.com/browse/LU-15618
Lustre-commit: 4fbd0705a3d25bbc8 ("LU-15618 lnet: Return ESHUTDOWN in lnet_parse()")

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

---
 net/lnet/lnet/lib-move.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/lnet/lnet/lib-move.c +1 -1
index 9ee1075..0c5bf82 100644
@@ -4425,7 +4425,7 @@ void lnet_monitor_thr_stop(void)
 		kfree(msg);
 		if (rc == -ESHUTDOWN)
 			/* We are shutting down. Don't do anything more */
-			return 0;
+			return rc;
 		goto drop;
 	}
 
Signature · 1 line
1.8.3.1
#26 lore raw

PATCH 26/28 lustre: lov: remove lov_page

In reply to James Simmons

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

Remove the lov page layer since it does nothing but costs 24 bytes per page plus pointer chases.

WC-bug-id: https://jira.whamcloud.com/browse/LU-10994
Lustre-commit: 56f520b1a4c9ae64c ("LU-10994 lov: remove lov_page")

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

---
 fs/lustre/include/cl_object.h   | 13 ++++++------
 fs/lustre/lov/lov_cl_internal.h | 32 ++++++++++++----------------
 fs/lustre/lov/lov_object.c      |  5 ++---
 fs/lustre/lov/lov_page.c        | 46 ++++++-----------------------------------
 4 files changed, 27 insertions(+), 69 deletions(-)
fs/lustre/include/cl_object.h +6 -7
index 06f03b4..5be89d6 100644
@@ -720,7 +720,7 @@ enum cl_page_type {
 
 #define	CP_STATE_BITS	4
 #define	CP_TYPE_BITS	2
-#define	CP_MAX_LAYER	3
+#define	CP_MAX_LAYER	2
 
 /**
  * Fields are protected by the lock on struct page, except for atomics and
@@ -751,22 +751,21 @@ struct cl_page {
 	/** Linkage of pages within group. Pages must be owned */
 	struct list_head		 cp_batch;
 	/** array of slices offset. Immutable after creation. */
-	unsigned char			 cp_layer_offset[CP_MAX_LAYER]; /* 24 bits */
+	unsigned char			 cp_layer_offset[CP_MAX_LAYER];
 	/** current slice index */
-	unsigned char			 cp_layer_count:2; /* 26 bits */
+	unsigned char			 cp_layer_count:2;
 	/**
 	 * Page state. This field is const to avoid accidental update, it is
 	 * modified only internally within cl_page.c. Protected by a VM lock.
 	 */
-	enum cl_page_state		 cp_state:CP_STATE_BITS; /* 30 bits */
+	enum cl_page_state		 cp_state:CP_STATE_BITS;
 	/**
 	 * Page type. Only CPT_TRANSIENT is used so far. Immutable after
 	 * creation.
 	 */
-	enum cl_page_type		 cp_type:CP_TYPE_BITS; /* 32 bits */
+	enum cl_page_type		 cp_type:CP_TYPE_BITS;
 	/* which slab kmem index this memory allocated from */
-	short int			 cp_kmem_index; /* 48 bits */
-	unsigned int			 cp_unused1:16; /* 64 bits */
+	short int			 cp_kmem_index;
 
 	/**
 	 * Owning IO in cl_page_state::CPS_OWNED state. Sub-page can be owned
fs/lustre/lov/lov_cl_internal.h +13 -19
index 6b96543..95dbb43 100644
@@ -48,14 +48,13 @@
 /** \defgroup lov lov
  * Logical object volume layer. This layer implements data striping (raid0).
  *
- * At the lov layer top-entity (object, page, lock, io) is connected to one or
+ * At the lov layer top-entity (object, lock, io) is connected to one or
  * more sub-entities: top-object, representing a file is connected to a set of
  * sub-objects, each representing a stripe, file-level top-lock is connected
- * to a set of per-stripe sub-locks, top-page is connected to a (single)
- * sub-page, and a top-level IO is connected to a set of (potentially
- * concurrent) sub-IO's.
+ * to a set of per-stripe sub-locks, and a top-level IO is connected to a set of
+ * (potentially concurrent) sub-IO's.
  *
- * Sub-object, sub-page, and sub-io have well-defined top-object and top-page
+ * Sub-object and sub-io have well-defined top-object and top-io
  * respectively, while a single sub-lock can be part of multiple top-locks.
  *
  * Reference counting models are different for different types of entities:
@@ -63,9 +62,6 @@
  *     - top-object keeps a reference to its sub-objects, and destroys them
  *       when it is destroyed.
  *
- *     - top-page keeps a reference to its sub-page, and destroys it when it
- *       is destroyed.
- *
  *     - IO's are not reference counted.
  *
  * To implement a connection between top and sub entities, lov layer is split
@@ -441,10 +437,6 @@ struct lov_lock {
 	struct lov_lock_sub     lls_sub[0];
 };
 
-struct lov_page {
-	struct cl_page_slice	lps_cl;
-};
-
 /*
  * Bottom half.
  */
@@ -626,6 +618,15 @@ int lov_io_init_released(const struct lu_env *env, struct cl_object *obj,
 struct lov_io_sub *lov_sub_get(const struct lu_env *env, struct lov_io *lio,
 			       int stripe);
 
+enum {
+	CP_LOV_INDEX_EMPTY = -1U,
+};
+
+static inline bool lov_page_is_empty(const struct cl_page *cp)
+{
+	return cp->cp_lov_index == CP_LOV_INDEX_EMPTY;
+}
+
 int lov_page_init_empty(const struct lu_env *env, struct cl_object *obj,
 			struct cl_page *page, pgoff_t index);
 int lov_page_init_composite(const struct lu_env *env, struct cl_object *obj,
@@ -640,7 +641,6 @@ struct lu_object *lovsub_object_alloc(const struct lu_env *env,
 				      const struct lu_object_header *hdr,
 				      struct lu_device *dev);
 
-bool lov_page_is_empty(const struct cl_page *page);
 int lov_lsm_entry(const struct lov_stripe_md *lsm, u64 offset);
 int lov_io_layout_at(struct lov_io *lio, u64 offset);
 
@@ -776,12 +776,6 @@ static inline struct lov_lock *cl2lov_lock(const struct cl_lock_slice *slice)
 	return container_of(slice, struct lov_lock, lls_cl);
 }
 
-static inline struct lov_page *cl2lov_page(const struct cl_page_slice *slice)
-{
-	LINVRNT(lov_is_object(&slice->cpl_obj->co_lu));
-	return container_of(slice, struct lov_page, lps_cl);
-}
-
 static inline struct lov_io *cl2lov_io(const struct lu_env *env,
 				       const struct cl_io_slice *ios)
 {
fs/lustre/lov/lov_object.c +2 -3
index d9eaf15..3934a98 100644
@@ -113,8 +113,7 @@ static int lov_page_slice_fixup(struct lov_object *lov,
 	struct cl_object *o;
 
 	if (!stripe)
-		return hdr->coh_page_bufsize - lov->lo_cl.co_slice_off -
-		       cfs_size_round(sizeof(struct lov_page));
+		return hdr->coh_page_bufsize - lov->lo_cl.co_slice_off;
 
 	cl_object_for_each(o, stripe)
 		o->co_slice_off += hdr->coh_page_bufsize;
@@ -1329,7 +1328,7 @@ static int lov_object_init(const struct lu_env *env, struct lu_object *obj,
 	init_rwsem(&lov->lo_type_guard);
 	atomic_set(&lov->lo_active_ios, 0);
 	init_waitqueue_head(&lov->lo_waitq);
-	cl_object_page_init(lu2cl(obj), sizeof(struct lov_page));
+	cl_object_page_init(lu2cl(obj), 0);
 
 	lov->lo_type = LLT_EMPTY;
 	if (cconf->u.coc_layout.lb_buf) {
fs/lustre/lov/lov_page.c +6 -40

85 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#27 lore raw

PATCH 27/28 lnet: libcfs: libcfs_debug_mb set incorrectly on init

In reply to James Simmons

From: Chris Horn <[email protected]>

If libcfs_debug_mb parameter is specified to insmod (i.e. set before module is initialized) then it does not get initialized correctly.

libcfs_param_debug_mb_set() expects cfs_trace_get_debug_mb() to return zero if the module has not been initialized yet, but cfs_trace_get_debug_mb() will return 1 in this case. Modify cfs_trace_get_debug_mb() to return zero as expected. A related issue is that in this case we need to call cfs_trace_get_debug_mb() after cfs_tracefile_init() so that libcfs_debug_mb gets the same value it would get if we had set it after module init.

When libcfs_debug_mb is specified to insmod, libcfs_debug_init() divides its value by num_possible_cpus(), but this is already done in libcfs_param_debug_mb_set().

Fixes 205b154f3b ("lustre: always range-check libcfs_debug_mb setting.")

HPE-bug-id: LUS-10839
WC-bug-id: https://jira.whamcloud.com/browse/LU-15689
Lustre-commit: d38ef181d8250b083 ("LU-15689 libcfs: libcfs_debug_mb set incorrectly on init")

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

---
 net/lnet/libcfs/debug.c     | 9 +++------
 net/lnet/libcfs/tracefile.c | 5 ++++-
 2 files changed, 7 insertions(+), 7 deletions(-)
net/lnet/libcfs/debug.c +3 -6
index f8ff5f7..c00e6da 100644
@@ -544,12 +544,10 @@ int libcfs_debug_init(unsigned long bufsize)
 	/* If libcfs_debug_mb is uninitialized then just make the
 	 * total buffers smp_num_cpus * TCD_MAX_PAGES
 	 */
-	if (max < num_possible_cpus()) {
+	if (max < num_possible_cpus())
 		max = TCD_MAX_PAGES;
-	} else {
-		max = max / num_possible_cpus();
+	else
 		max <<= (20 - PAGE_SHIFT);
-	}
 
 	rc = cfs_tracefile_init(max);
 	if (rc)
@@ -557,8 +555,7 @@ int libcfs_debug_init(unsigned long bufsize)
 
 	libcfs_register_panic_notifier();
 	kernel_param_lock(THIS_MODULE);
-	if (libcfs_debug_mb == 0)
-		libcfs_debug_mb = cfs_trace_get_debug_mb();
+	libcfs_debug_mb = cfs_trace_get_debug_mb();
 	kernel_param_unlock(THIS_MODULE);
 	return rc;
 }
net/lnet/libcfs/tracefile.c +4 -1
index 948eaaa..f0b7a2e 100644
@@ -1000,7 +1000,10 @@ int cfs_trace_get_debug_mb(void)
 
 	up_read(&cfs_tracefile_sem);
 
-	return (total_pages >> (20 - PAGE_SHIFT)) + 1;
+	if (total_pages)
+		return (total_pages >> (20 - PAGE_SHIFT)) + 1;
+	else
+		return 0;
 }
 
 static int tracefiled(void *arg)
Signature · 1 line
1.8.3.1
#28 lore raw

PATCH 28/28 lustre: ptlrpc: don't report eviction for light weigth connections

In reply to James Simmons

From: Alex Zhuravlev <[email protected]>

lightweight connections aren't persistent, so they found themselves "evicted" after target's restart, which is not correct. don't confuse people with false error.

WC-bug-id: https://jira.whamcloud.com/browse/LU-15865
Lustre-commit: 3e5dc84be447e16a8 ("LU-15865 ptlrpc: don't report eviction for lwp")

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

---
 fs/lustre/ptlrpc/import.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/lustre/ptlrpc/import.c +4 -1
index d685b96..a5fdb8a8 100644
@@ -1516,12 +1516,15 @@ int ptlrpc_import_recovery_state_machine(struct obd_import *imp)
 
 	if (imp->imp_state == LUSTRE_IMP_EVICTED) {
 		struct task_struct *task;
+		u64 connect_flags;
 
 		deuuidify(obd2cli_tgt(imp->imp_obd), NULL,
 			  &target_start, &target_len);
+		connect_flags = imp->imp_connect_data.ocd_connect_flags;
 		/* Don't care about MGC eviction */
 		if (strcmp(imp->imp_obd->obd_type->typ_name,
-			   LUSTRE_MGC_NAME) != 0) {
+			   LUSTRE_MGC_NAME) != 0 &&
+		    (connect_flags & OBD_CONNECT_LIGHTWEIGHT) == 0) {
 			LCONSOLE_ERROR_MSG(0x167,
 					   "%s: This client was evicted by %.*s; in progress operations using this service will fail.\n",
 					   imp->imp_obd->obd_name, target_len,
Signature · 1 line
1.8.3.1