From patchwork Sat Jun 18 13:51:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886395 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91991CCA480 for ; Sat, 18 Jun 2022 13:52:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229492AbiFRNwh (ORCPT ); Sat, 18 Jun 2022 09:52:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232419AbiFRNwT (ORCPT ); Sat, 18 Jun 2022 09:52:19 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56FA31D328 for ; Sat, 18 Jun 2022 06:52:18 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id EB62F13C3; Sat, 18 Jun 2022 09:52:13 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id DD002E4F1D; Sat, 18 Jun 2022 09:52:13 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, James Simmons Subject: [PATCH 01/28] lustre: osc: handle removal of NR_UNSTABLE_NFS Date: Sat, 18 Jun 2022 09:51:43 -0400 Message-Id: <1655560330-30743-2-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Mr NeilBrown 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") Signed-off-by: Mr NeilBrown Reviewed-on: https://review.whamcloud.com/39260 Reviewed-by: Shaun Tancheff Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/osc/osc_page.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/lustre/osc/osc_page.c b/fs/lustre/osc/osc_page.c index b56bc1a..fd87698 100644 --- a/fs/lustre/osc/osc_page.c +++ b/fs/lustre/osc/osc_page.c @@ -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, From patchwork Sat Jun 18 13:51:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886393 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F02CC43334 for ; Sat, 18 Jun 2022 13:52:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233965AbiFRNwk (ORCPT ); Sat, 18 Jun 2022 09:52:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233293AbiFRNwY (ORCPT ); Sat, 18 Jun 2022 09:52:24 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 205691D328 for ; Sat, 18 Jun 2022 06:52:22 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id EF59813C5; Sat, 18 Jun 2022 09:52:13 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id DFAF7E9152; Sat, 18 Jun 2022 09:52:13 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, James Simmons Subject: [PATCH 02/28] lustre: llite: switch from ->mmap_sem to mmap_lock() Date: Sat, 18 Jun 2022 09:51:44 -0400 Message-Id: <1655560330-30743-3-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Mr NeilBrown 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()") Signed-off-by: Mr NeilBrown Reviewed-on: https://review.whamcloud.com/40288 Reviewed-by: James Simmons Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- 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(-) diff --git a/fs/lustre/llite/llite_internal.h b/fs/lustre/llite/llite_internal.h index bc50169..426c797 100644 --- a/fs/lustre/llite/llite_internal.h +++ b/fs/lustre/llite/llite_internal.h @@ -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. diff --git a/fs/lustre/llite/llite_mmap.c b/fs/lustre/llite/llite_mmap.c index d87a68d..2e762b1 100644 --- a/fs/lustre/llite/llite_mmap.c +++ b/fs/lustre/llite/llite_mmap.c @@ -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); diff --git a/fs/lustre/llite/pcc.c b/fs/lustre/llite/pcc.c index 8bdf681e..ec35061 100644 --- a/fs/lustre/llite/pcc.c +++ b/fs/lustre/llite/pcc.c @@ -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; } diff --git a/fs/lustre/llite/vvp_io.c b/fs/lustre/llite/vvp_io.c index 77e54ce..75c5224 100644 --- a/fs/lustre/llite/vvp_io.c +++ b/fs/lustre/llite/vvp_io.c @@ -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; } From patchwork Sat Jun 18 13:51:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886397 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80749CCA473 for ; Sat, 18 Jun 2022 13:52:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233932AbiFRNwj (ORCPT ); Sat, 18 Jun 2022 09:52:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232528AbiFRNwV (ORCPT ); Sat, 18 Jun 2022 09:52:21 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB7EC1D328 for ; Sat, 18 Jun 2022 06:52:19 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id ED05213C4; Sat, 18 Jun 2022 09:52:13 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id E3D7CFD3BF; Sat, 18 Jun 2022 09:52:13 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, James Simmons Subject: [PATCH 03/28] lnet: support removal of kernel_setsockopt() Date: Sat, 18 Jun 2022 09:51:45 -0400 Message-Id: <1655560330-30743-4-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Mr NeilBrown 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()") Signed-off-by: Mr NeilBrown Reviewed-on: https://review.whamcloud.com/39259 Reviewed-by: Aurelien Degremont Reviewed-by: Chris Horn Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- 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(-) diff --git a/include/linux/lnet/lib-lnet.h b/include/linux/lnet/lib-lnet.h index ca2a565..ceb12b1 100644 --- a/include/linux/lnet/lib-lnet.h +++ b/include/linux/lnet/lib-lnet.h @@ -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); diff --git a/net/lnet/klnds/socklnd/socklnd_lib.c b/net/lnet/klnds/socklnd/socklnd_lib.c index 78e58f6..047e7a6 100644 --- a/net/lnet/klnds/socklnd/socklnd_lib.c +++ b/net/lnet/klnds/socklnd/socklnd_lib.c @@ -147,17 +147,13 @@ void ksocknal_lib_eager_ack(struct ksock_conn *conn) { - int opt = 1; struct socket *sock = conn->ksnc_sock; - /* - * Remind the socket to ACK eagerly. If I don't, the socket might - * think I'm about to send something it could piggy-back the ACK - * on, introducing delay in completing zero-copy sends in my - * peer_ni. + /* Remind the socket to ACK eagerly. If I don't, the socket might + * think I'm about to send something it could piggy-back the ACK on, + * introducing delay in completing zero-copy sends in my peer_ni. */ - kernel_setsockopt(sock, SOL_TCP, TCP_QUICKACK, (char *)&opt, - sizeof(opt)); + tcp_sock_set_quickack(sock->sk, 1); } static int lustre_csum(struct kvec *v, void *context) @@ -235,87 +231,47 @@ static int lustre_csum(struct kvec *v, void *context) int *rxmem, int *nagle) { struct socket *sock = conn->ksnc_sock; - int len; - int rc; + struct tcp_sock *tp = tcp_sk(sock->sk); - rc = ksocknal_connsock_addref(conn); - if (rc) { + if (ksocknal_connsock_addref(conn) < 0) { LASSERT(conn->ksnc_closing); - *txmem = *rxmem = *nagle = 0; + *txmem = 0; + *rxmem = 0; + *nagle = 0; return -ESHUTDOWN; } - rc = lnet_sock_getbuf(sock, txmem, rxmem); - if (!rc) { - len = sizeof(*nagle); - rc = kernel_getsockopt(sock, SOL_TCP, TCP_NODELAY, - (char *)nagle, &len); - } + lnet_sock_getbuf(sock, txmem, rxmem); - ksocknal_connsock_decref(conn); + *nagle = !(tp->nonagle & TCP_NAGLE_OFF); - if (!rc) - *nagle = !*nagle; - else - *txmem = *rxmem = *nagle = 0; + ksocknal_connsock_decref(conn); - return rc; + return 0; } int ksocknal_lib_setup_sock(struct socket *sock) { int rc; - int option; int keep_idle; int keep_intvl; int keep_count; int do_keepalive; - struct linger linger; + struct tcp_sock *tp = tcp_sk(sock->sk); sock->sk->sk_allocation = GFP_NOFS; - /* - * Ensure this socket aborts active sends immediately when we close - * it. - */ - linger.l_onoff = 0; - linger.l_linger = 0; - - rc = kernel_setsockopt(sock, SOL_SOCKET, SO_LINGER, (char *)&linger, - sizeof(linger)); - if (rc) { - CERROR("Can't set SO_LINGER: %d\n", rc); - return rc; - } - - option = -1; - rc = kernel_setsockopt(sock, SOL_TCP, TCP_LINGER2, (char *)&option, - sizeof(option)); - if (rc) { - CERROR("Can't set SO_LINGER2: %d\n", rc); - return rc; - } - - if (!*ksocknal_tunables.ksnd_nagle) { - option = 1; + /* Ensure this socket aborts active sends immediately when closed. */ + sock_reset_flag(sock->sk, SOCK_LINGER); - rc = kernel_setsockopt(sock, SOL_TCP, TCP_NODELAY, - (char *)&option, sizeof(option)); - if (rc) { - CERROR("Can't disable nagle: %d\n", rc); - return rc; - } - } + tp->linger2 = -1; + if (!*ksocknal_tunables.ksnd_nagle) + tcp_sock_set_nodelay(sock->sk); - rc = lnet_sock_setbuf(sock, *ksocknal_tunables.ksnd_tx_buffer_size, - *ksocknal_tunables.ksnd_rx_buffer_size); - if (rc) { - CERROR("Can't set buffer tx %d, rx %d buffers: %d\n", - *ksocknal_tunables.ksnd_tx_buffer_size, - *ksocknal_tunables.ksnd_rx_buffer_size, rc); - return rc; - } + lnet_sock_setbuf(sock, + *ksocknal_tunables.ksnd_tx_buffer_size, + *ksocknal_tunables.ksnd_rx_buffer_size); /* TCP_BACKOFF_* sockopt tunables unsupported in stock kernels */ @@ -326,34 +282,30 @@ static int lustre_csum(struct kvec *v, void *context) do_keepalive = (keep_idle > 0 && keep_count > 0 && keep_intvl > 0); - option = (do_keepalive ? 1 : 0); - rc = kernel_setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (char *)&option, - sizeof(option)); - if (rc) { - CERROR("Can't set SO_KEEPALIVE: %d\n", rc); - return rc; - } + if (sock->sk->sk_prot->keepalive) + sock->sk->sk_prot->keepalive(sock->sk, do_keepalive); + if (do_keepalive) + sock_set_flag(sock->sk, SOCK_KEEPOPEN); + else + sock_reset_flag(sock->sk, SOCK_KEEPOPEN); if (!do_keepalive) return 0; - rc = kernel_setsockopt(sock, SOL_TCP, TCP_KEEPIDLE, (char *)&keep_idle, - sizeof(keep_idle)); - if (rc) { + rc = tcp_sock_set_keepidle(sock->sk, keep_idle); + if (rc != 0) { CERROR("Can't set TCP_KEEPIDLE: %d\n", rc); return rc; } - rc = kernel_setsockopt(sock, SOL_TCP, TCP_KEEPINTVL, - (char *)&keep_intvl, sizeof(keep_intvl)); - if (rc) { + rc = tcp_sock_set_keepintvl(sock->sk, keep_intvl); + if (rc != 0) { CERROR("Can't set TCP_KEEPINTVL: %d\n", rc); return rc; } - rc = kernel_setsockopt(sock, SOL_TCP, TCP_KEEPCNT, (char *)&keep_count, - sizeof(keep_count)); - if (rc) { + rc = tcp_sock_set_keepcnt(sock->sk, keep_count); + if (rc != 0) { CERROR("Can't set TCP_KEEPCNT: %d\n", rc); return rc; } @@ -367,7 +319,6 @@ static int lustre_csum(struct kvec *v, void *context) struct sock *sk; struct tcp_sock *tp; int nonagle; - int val = 1; int rc; rc = ksocknal_connsock_addref(conn); @@ -379,12 +330,10 @@ static int lustre_csum(struct kvec *v, void *context) lock_sock(sk); nonagle = tp->nonagle; - tp->nonagle = 1; + tp->nonagle = TCP_NAGLE_OFF; release_sock(sk); - rc = kernel_setsockopt(conn->ksnc_sock, SOL_TCP, TCP_NODELAY, - (char *)&val, sizeof(val)); - LASSERT(!rc); + tcp_sock_set_nodelay(conn->ksnc_sock->sk); lock_sock(sk); tp->nonagle = nonagle; diff --git a/net/lnet/lnet/lib-socket.c b/net/lnet/lnet/lib-socket.c index 7deb48a..7bb8d5c 100644 --- a/net/lnet/lnet/lib-socket.c +++ b/net/lnet/lnet/lib-socket.c @@ -182,7 +182,6 @@ int choose_ipv4_src(u32 *ret, int interface, u32 dst_ipaddr, struct net *ns) { struct socket *sock; int rc; - int option; int family; family = AF_INET6; @@ -200,13 +199,7 @@ int choose_ipv4_src(u32 *ret, int interface, u32 dst_ipaddr, struct net *ns) return ERR_PTR(rc); } - option = 1; - rc = kernel_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, - (char *)&option, sizeof(option)); - if (rc) { - CERROR("Can't set SO_REUSEADDR for socket: %d\n", rc); - goto failed; - } + sock->sk->sk_reuseport = 1; if (interface >= 0 || local_port) { struct sockaddr_storage locaddr = {}; @@ -296,34 +289,21 @@ int choose_ipv4_src(u32 *ret, int interface, u32 dst_ipaddr, struct net *ns) return ERR_PTR(rc); } -int +void lnet_sock_setbuf(struct socket *sock, int txbufsize, int rxbufsize) { - int option; - int rc; + struct sock *sk = sock->sk; if (txbufsize) { - option = txbufsize; - rc = kernel_setsockopt(sock, SOL_SOCKET, SO_SNDBUF, - (char *)&option, sizeof(option)); - if (rc) { - CERROR("Can't set send buffer %d: %d\n", - option, rc); - return rc; - } + sk->sk_userlocks |= SOCK_SNDBUF_LOCK; + sk->sk_sndbuf = txbufsize; + sk->sk_write_space(sk); } if (rxbufsize) { - option = rxbufsize; - rc = kernel_setsockopt(sock, SOL_SOCKET, SO_RCVBUF, - (char *)&option, sizeof(option)); - if (rc) { - CERROR("Can't set receive buffer %d: %d\n", - option, rc); - return rc; - } + sk->sk_userlocks |= SOCK_RCVBUF_LOCK; + sk->sk_sndbuf = rxbufsize; } - return 0; } EXPORT_SYMBOL(lnet_sock_setbuf); @@ -359,16 +339,13 @@ int choose_ipv4_src(u32 *ret, int interface, u32 dst_ipaddr, struct net *ns) } EXPORT_SYMBOL(lnet_sock_getaddr); -int -lnet_sock_getbuf(struct socket *sock, int *txbufsize, int *rxbufsize) +void lnet_sock_getbuf(struct socket *sock, int *txbufsize, int *rxbufsize) { if (txbufsize) *txbufsize = sock->sk->sk_sndbuf; if (rxbufsize) *rxbufsize = sock->sk->sk_rcvbuf; - - return 0; } EXPORT_SYMBOL(lnet_sock_getbuf); From patchwork Sat Jun 18 13:51:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886392 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CDB0C433EF for ; Sat, 18 Jun 2022 13:52:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233973AbiFRNwk (ORCPT ); Sat, 18 Jun 2022 09:52:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229542AbiFRNwZ (ORCPT ); Sat, 18 Jun 2022 09:52:25 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB1941D328 for ; Sat, 18 Jun 2022 06:52:24 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id F1DF113C6; Sat, 18 Jun 2022 09:52:13 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id E7D5A1002C9; Sat, 18 Jun 2022 09:52:13 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, Sergey Gorenko , James Simmons Subject: [PATCH 04/28] lnet: o2ib: Fix compilation with Linux 5.8 Date: Sat, 18 Jun 2022 09:51:46 -0400 Message-Id: <1655560330-30743-5-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Sergey Gorenko 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") Signed-off-by: Sergey Gorenko Reviewed-on: https://review.whamcloud.com/39323 Reviewed-by: Neil Brown Reviewed-by: Alexey Lyashkov Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- net/lnet/klnds/o2iblnd/o2iblnd_cb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/lnet/klnds/o2iblnd/o2iblnd_cb.c b/net/lnet/klnds/o2iblnd/o2iblnd_cb.c index a88939e7..cb96282 100644 --- a/net/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/net/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -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); } From patchwork Sat Jun 18 13:51:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886396 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3431CCA482 for ; Sat, 18 Jun 2022 13:52:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234073AbiFRNwl (ORCPT ); Sat, 18 Jun 2022 09:52:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233887AbiFRNwb (ORCPT ); Sat, 18 Jun 2022 09:52:31 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0E481DA48 for ; Sat, 18 Jun 2022 06:52:30 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 080FA13D5; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id EC7551002D3; Sat, 18 Jun 2022 09:52:13 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, James Simmons Subject: [PATCH 05/28] lnet: improve compat code for IPV6_V6ONLY sock opt Date: Sat, 18 Jun 2022 09:51:47 -0400 Message-Id: <1655560330-30743-6-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Mr NeilBrown 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") Signed-off-by: Mr NeilBrown Reviewed-on: https://review.whamcloud.com/43559 Reviewed-by: James Simmons Reviewed-by: Arshad Hussain Reviewed-by: Chris Horn Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- net/lnet/lnet/lib-socket.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/net/lnet/lnet/lib-socket.c b/net/lnet/lnet/lib-socket.c index 7bb8d5c..3a99cb6 100644 --- a/net/lnet/lnet/lib-socket.c +++ b/net/lnet/lnet/lib-socket.c @@ -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, From patchwork Sat Jun 18 13:51:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886398 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E26D3CCA481 for ; Sat, 18 Jun 2022 13:52:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233988AbiFRNwk (ORCPT ); Sat, 18 Jun 2022 09:52:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233500AbiFRNw1 (ORCPT ); Sat, 18 Jun 2022 09:52:27 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2F921D328 for ; Sat, 18 Jun 2022 06:52:25 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 07BFA13C7; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id EFB1E1002DD; Sat, 18 Jun 2022 09:52:13 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, James Simmons , Sebastien Buisson Subject: [PATCH 06/28] lustre: sec: support test_dummy_encryption=v2 Date: Sat, 18 Jun 2022 09:51:48 -0400 Message-Id: <1655560330-30743-7-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org 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") Signed-off-by: James Simmons Signed-off-by: Sebastien Buisson Reviewed-on: https://review.whamcloud.com/46238 Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin --- 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(-) diff --git a/fs/lustre/include/lustre_crypto.h b/fs/lustre/include/lustre_crypto.h index 6cc946d..c31cc1e 100644 --- a/fs/lustre/include/lustre_crypto.h +++ b/fs/lustre/include/lustre_crypto.h @@ -32,11 +32,16 @@ #include +/* 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_ */ diff --git a/fs/lustre/include/lustre_disk.h b/fs/lustre/include/lustre_disk.h index d8686fc..15f94ad8 100644 --- a/fs/lustre/include/lustre_disk.h +++ b/fs/lustre/include/lustre_disk.h @@ -47,6 +47,7 @@ #include #include #include +#include /****************** 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 diff --git a/fs/lustre/llite/crypto.c b/fs/lustre/llite/crypto.c index b0e4f76..f075b9a 100644 --- a/fs/lustre/llite/crypto.c +++ b/fs/lustre/llite/crypto.c @@ -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, }; diff --git a/fs/lustre/llite/dir.c b/fs/lustre/llite/dir.c index 29d7e44..6eaac9a 100644 --- a/fs/lustre/llite/dir.c +++ b/fs/lustre/llite/dir.c @@ -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; diff --git a/fs/lustre/llite/llite_internal.h b/fs/lustre/llite/llite_internal.h index 426c797..b052e82 100644 --- a/fs/lustre/llite/llite_internal.h +++ b/fs/lustre/llite/llite_internal.h @@ -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, diff --git a/fs/lustre/llite/llite_lib.c b/fs/lustre/llite/llite_lib.c index 99ab9ac..aaff3fa 100644 --- a/fs/lustre/llite/llite_lib.c +++ b/fs/lustre/llite/llite_lib.c @@ -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; } diff --git a/fs/lustre/llite/namei.c b/fs/lustre/llite/namei.c index f7e900d..cc7b243 100644 --- a/fs/lustre/llite/namei.c +++ b/fs/lustre/llite/namei.c @@ -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; From patchwork Sat Jun 18 13:51:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886394 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1983CCA47C for ; Sat, 18 Jun 2022 13:52:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234117AbiFRNwl (ORCPT ); Sat, 18 Jun 2022 09:52:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233710AbiFRNwa (ORCPT ); Sat, 18 Jun 2022 09:52:30 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 858901D328 for ; Sat, 18 Jun 2022 06:52:28 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 0807813CD; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id F34B2100388; Sat, 18 Jun 2022 09:52:13 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, Alexander Boyko , James Simmons Subject: [PATCH 07/28] lustre: lmv: try another MDT if statfs failed Date: Sat, 18 Jun 2022 09:51:49 -0400 Message-Id: <1655560330-30743-8-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Alexander Boyko 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") Signed-off-by: Alexander Boyko Reviewed-on: https://review.whamcloud.com/47152 Reviewed-by: Andreas Dilger Reviewed-by: Alexander Zarochentsev Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/lmv/lmv_obd.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/fs/lustre/lmv/lmv_obd.c b/fs/lustre/lmv/lmv_obd.c index d83ba41ff..3af7a53 100644 --- a/fs/lustre/lmv/lmv_obd.c +++ b/fs/lustre/lmv/lmv_obd.c @@ -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; From patchwork Sat Jun 18 13:51:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886400 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E7E1C43334 for ; Sat, 18 Jun 2022 13:52:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229542AbiFRNwr (ORCPT ); Sat, 18 Jun 2022 09:52:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233897AbiFRNwf (ORCPT ); Sat, 18 Jun 2022 09:52:35 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EED1C1D328 for ; Sat, 18 Jun 2022 06:52:31 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 0A8A113D6; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 0352ADC803; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, Bobi Jam , James Simmons Subject: [PATCH 08/28] lustre: ec: add necessary structure member for EC file Date: Sat, 18 Jun 2022 09:51:50 -0400 Message-Id: <1655560330-30743-9-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Bobi Jam 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") Signed-off-by: Bobi Jam Reviewed-on: https://review.whamcloud.com/38319 Reviewed-by: James Simmons Reviewed-by: Bobi Jam Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- 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(-) diff --git a/fs/lustre/ptlrpc/pack_generic.c b/fs/lustre/ptlrpc/pack_generic.c index f075188e..9acea24 100644 --- a/fs/lustre/ptlrpc/pack_generic.c +++ b/fs/lustre/ptlrpc/pack_generic.c @@ -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); diff --git a/fs/lustre/ptlrpc/wiretest.c b/fs/lustre/ptlrpc/wiretest.c index 687a54d..81e0485 100644 --- a/fs/lustre/ptlrpc/wiretest.c +++ b/fs/lustre/ptlrpc/wiretest.c @@ -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)); diff --git a/include/uapi/linux/lustre/lustre_user.h b/include/uapi/linux/lustre/lustre_user.h index fa01c28..ee789f2 100644 --- a/include/uapi/linux/lustre/lustre_user.h +++ b/include/uapi/linux/lustre/lustre_user.h @@ -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)); From patchwork Sat Jun 18 13:51:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886399 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D8B7C433EF for ; Sat, 18 Jun 2022 13:52:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231217AbiFRNwr (ORCPT ); Sat, 18 Jun 2022 09:52:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230469AbiFRNwj (ORCPT ); Sat, 18 Jun 2022 09:52:39 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEEFB1DA4C for ; Sat, 18 Jun 2022 06:52:35 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 0C47C13D7; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 0885CE4F1D; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, Lai Siyao , James Simmons Subject: [PATCH 09/28] lustre: llite: add option to disable Lustre inode cache Date: Sat, 18 Jun 2022 09:51:51 -0400 Message-Id: <1655560330-30743-10-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Lai Siyao 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") Signed-off-by: Lai Siyao Reviewed-on: https://review.whamcloud.com/39973 Reviewed-by: Andreas Dilger Reviewed-by: Olaf Faaland-LLNL Signed-off-by: James Simmons --- 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(-) diff --git a/fs/lustre/llite/llite_internal.h b/fs/lustre/llite/llite_internal.h index b052e82..70a42d4 100644 --- a/fs/lustre/llite/llite_internal.h +++ b/fs/lustre/llite/llite_internal.h @@ -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; diff --git a/fs/lustre/llite/llite_lib.c b/fs/lustre/llite/llite_lib.c index aaff3fa..6adbf10 100644 --- a/fs/lustre/llite/llite_lib.c +++ b/fs/lustre/llite/llite_lib.c @@ -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; diff --git a/fs/lustre/llite/lproc_llite.c b/fs/lustre/llite/lproc_llite.c index ce715b4..095b696 100644 --- a/fs/lustre/llite/lproc_llite.c +++ b/fs/lustre/llite/lproc_llite.c @@ -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, }; diff --git a/fs/lustre/llite/super25.c b/fs/lustre/llite/super25.c index f50c23a..5349a25 100644 --- a/fs/lustre/llite/super25.c +++ b/fs/lustre/llite/super25.c @@ -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); From patchwork Sat Jun 18 13:51:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886401 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2109C433EF for ; Sat, 18 Jun 2022 13:53:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230356AbiFRNw6 (ORCPT ); Sat, 18 Jun 2022 09:52:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233293AbiFRNwu (ORCPT ); Sat, 18 Jun 2022 09:52:50 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 755E1206 for ; Sat, 18 Jun 2022 06:52:40 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 1327713D8; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 0C78FE9152; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, Serguei Smirnov , James Simmons Subject: [PATCH 10/28] lnet: o2iblnd: clean up zombie connections on shutdown Date: Sat, 18 Jun 2022 09:51:52 -0400 Message-Id: <1655560330-30743-11-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Serguei Smirnov 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") Signed-off-by: Serguei Smirnov Reviewed-on: https://review.whamcloud.com/42068 Reviewed-by: Cyril Bordage Reviewed-by: Chris Horn Reviewed-by: Alexey Lyashkov Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- net/lnet/klnds/o2iblnd/o2iblnd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/lnet/klnds/o2iblnd/o2iblnd.c b/net/lnet/klnds/o2iblnd/o2iblnd.c index 8dce4179..65bc89b 100644 --- a/net/lnet/klnds/o2iblnd/o2iblnd.c +++ b/net/lnet/klnds/o2iblnd/o2iblnd.c @@ -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: From patchwork Sat Jun 18 13:51:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886402 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B21E8C43334 for ; Sat, 18 Jun 2022 13:53:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232528AbiFRNw7 (ORCPT ); Sat, 18 Jun 2022 09:52:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233887AbiFRNwz (ORCPT ); Sat, 18 Jun 2022 09:52:55 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80992DAB for ; Sat, 18 Jun 2022 06:52:53 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 1783913E6; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 105F1FD3BF; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, Andrew Elwell , James Simmons Subject: [PATCH 11/28] lustre: ptlrpc: Rearrange version mismatch message Date: Sat, 18 Jun 2022 09:51:53 -0400 Message-Id: <1655560330-30743-12-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Andrew Elwell 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") Signed-off-by: Andrew Elwell Reviewed-on: https://review.whamcloud.com/44029 Reviewed-by: Patrick Farrell Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/ptlrpc/import.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/lustre/ptlrpc/import.c b/fs/lustre/ptlrpc/import.c index c0aee34..d685b96 100644 --- a/fs/lustre/ptlrpc/import.c +++ b/fs/lustre/ptlrpc/import.c @@ -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; } From patchwork Sat Jun 18 13:51:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886403 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D27D3CCA47C for ; Sat, 18 Jun 2022 13:53:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230469AbiFRNw6 (ORCPT ); Sat, 18 Jun 2022 09:52:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233500AbiFRNwx (ORCPT ); Sat, 18 Jun 2022 09:52:53 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B026CB2A for ; Sat, 18 Jun 2022 06:52:50 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 16B2F13DB; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 151FC1002C9; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, Patrick Farrell , James Simmons Subject: [PATCH 12/28] lustre: llite: Correct cl_env comments Date: Sat, 18 Jun 2022 09:51:54 -0400 Message-Id: <1655560330-30743-13-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Patrick Farrell 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") Signed-off-by: Patrick Farrell Reviewed-on: https://review.whamcloud.com/44191 Reviewed-by: Andreas Dilger Reviewed-by: Wang Shilong Reviewed-by: Sebastien Buisson Reviewed-by: John L. Hammond Signed-off-by: James Simmons --- fs/lustre/obdclass/cl_object.c | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/fs/lustre/obdclass/cl_object.c b/fs/lustre/obdclass/cl_object.c index c5deb5c..6f87160 100644 --- a/fs/lustre/obdclass/cl_object.c +++ b/fs/lustre/obdclass/cl_object.c @@ -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) { From patchwork Sat Jun 18 13:51:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886405 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6E12C43334 for ; Sat, 18 Jun 2022 14:00:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233293AbiFRNxL (ORCPT ); Sat, 18 Jun 2022 09:53:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234164AbiFRNw6 (ORCPT ); Sat, 18 Jun 2022 09:52:58 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C31BCE2E for ; Sat, 18 Jun 2022 06:52:55 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 1C98313E7; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 19855DC803; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, Cyril Bordage , Chris Horn , James Simmons Subject: [PATCH 13/28] lnet: set max recovery interval duration Date: Sat, 18 Jun 2022 09:51:55 -0400 Message-Id: <1655560330-30743-14-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Cyril Bordage 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 WC-bug-id: https://jira.whamcloud.com/browse/LU-14979 Lustre-commit: 4027395fe463b6ea1 ("LU-14979 lnet: set max recovery interval duration") Signed-off-by: Cyril Bordage Signed-off-by: Chris Horn Reviewed-on: https://review.whamcloud.com/44927 Reviewed-by: Serguei Smirnov Reviewed-by: Frank Sehr Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- include/linux/lnet/lib-lnet.h | 9 ++++---- net/lnet/lnet/api-ni.c | 49 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 4 deletions(-) diff --git a/include/linux/lnet/lib-lnet.h b/include/linux/lnet/lib-lnet.h index ceb12b1..e21866b 100644 --- a/include/linux/lnet/lib-lnet.h +++ b/include/linux/lnet/lib-lnet.h @@ -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; diff --git a/net/lnet/lnet/api-ni.c b/net/lnet/lnet/api-ni.c index 8643ac8d..165728d 100644 --- a/net/lnet/lnet/api-ni.c +++ b/net/lnet/lnet/api-ni.c @@ -117,6 +117,22 @@ static int recovery_interval_set(const char *val, MODULE_PARM_DESC(lnet_recovery_limit, "How long to attempt recovery of unhealthy peer interfaces in seconds. Set to 0 to allow indefinite recovery"); +unsigned int lnet_max_recovery_ping_interval = 900; +unsigned int lnet_max_recovery_ping_count = 9; +static int max_recovery_ping_interval_set(const char *val, + const struct kernel_param *kp); + +#define param_check_max_recovery_ping_interval(name, p) \ + __param_check(name, p, int) + +static struct kernel_param_ops param_ops_max_recovery_ping_interval = { + .set = max_recovery_ping_interval_set, + .get = param_get_int, +}; +module_param(lnet_max_recovery_ping_interval, max_recovery_ping_interval, 0644); +MODULE_PARM_DESC(lnet_max_recovery_ping_interval, + "The max interval between LNet recovery pings, in seconds"); + static int lnet_interfaces_max = LNET_INTERFACES_MAX_DEFAULT; static int intf_max_set(const char *val, const struct kernel_param *kp); module_param_call(lnet_interfaces_max, intf_max_set, param_get_int, @@ -258,6 +274,39 @@ static int lnet_discover(struct lnet_process_id id, u32 force, } static int +max_recovery_ping_interval_set(const char *val, const struct kernel_param *kp) +{ + int rc; + unsigned long value; + + rc = kstrtoul(val, 0, &value); + if (rc) { + CERROR("Invalid module parameter value for 'lnet_max_recovery_ping_interval'\n"); + return rc; + } + + if (!value) { + CERROR("Invalid max ping timeout. Must be strictly positive\n"); + return -EINVAL; + } + + /* The purpose of locking the api_mutex here is to ensure that + * the correct value ends up stored properly. + */ + mutex_lock(&the_lnet.ln_api_mutex); + lnet_max_recovery_ping_interval = value; + lnet_max_recovery_ping_count = 0; + value >>= 1; + while (value) { + lnet_max_recovery_ping_count++; + value >>= 1; + } + mutex_unlock(&the_lnet.ln_api_mutex); + + return 0; +} + +static int discovery_set(const char *val, const struct kernel_param *kp) { int rc; From patchwork Sat Jun 18 13:51:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886404 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B76CEC433EF for ; Sat, 18 Jun 2022 14:00:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234158AbiFRNxM (ORCPT ); Sat, 18 Jun 2022 09:53:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234185AbiFRNw7 (ORCPT ); Sat, 18 Jun 2022 09:52:59 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 289E01104 for ; Sat, 18 Jun 2022 06:52:58 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 1E4BE13F5; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 1CBADE4F1D; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, Alex Zhuravlev , James Simmons Subject: [PATCH 14/28] lnet: libcfs: reset hs_rehash_bits Date: Sat, 18 Jun 2022 09:51:56 -0400 Message-Id: <1655560330-30743-15-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Alex Zhuravlev 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") Signed-off-by: Alex Zhuravlev Reviewed-on: https://review.whamcloud.com/45533 Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- net/lnet/libcfs/hash.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/net/lnet/libcfs/hash.c b/net/lnet/libcfs/hash.c index d060eaa..c9ff92d 100644 --- a/net/lnet/libcfs/hash.c +++ b/net/lnet/libcfs/hash.c @@ -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 From patchwork Sat Jun 18 13:51:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886407 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF34CC43334 for ; Sat, 18 Jun 2022 14:01:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234392AbiFRNxM (ORCPT ); Sat, 18 Jun 2022 09:53:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234228AbiFRNxE (ORCPT ); Sat, 18 Jun 2022 09:53:04 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76A4610F3 for ; Sat, 18 Jun 2022 06:53:01 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 258EF13F6; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 21556E9152; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, Patrick Farrell , James Simmons Subject: [PATCH 15/28] lustre: llite: Make iotrace logging quieter Date: Sat, 18 Jun 2022 09:51:57 -0400 Message-Id: <1655560330-30743-16-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Patrick Farrell 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") Signed-off-by: Patrick Farrell Reviewed-on: https://review.whamcloud.com/45887 Reviewed-by: Andreas Dilger Reviewed-by: Sebastien Buisson Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/llite/rw.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/lustre/llite/rw.c b/fs/lustre/llite/rw.c index bd02a28..239f78b 100644 --- a/fs/lustre/llite/rw.c +++ b/fs/lustre/llite/rw.c @@ -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)); From patchwork Sat Jun 18 13:51:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886415 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEF60CCA480 for ; Sat, 18 Jun 2022 14:02:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229768AbiFROBK (ORCPT ); Sat, 18 Jun 2022 10:01:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234319AbiFRNxH (ORCPT ); Sat, 18 Jun 2022 09:53:07 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAEB110F3 for ; Sat, 18 Jun 2022 06:53:04 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 274B413F7; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 24B2DFD3BF; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, Patrick Farrell , James Simmons Subject: [PATCH 16/28] lustre: llite: Add strided readahead to iotrace Date: Sat, 18 Jun 2022 09:51:58 -0400 Message-Id: <1655560330-30743-17-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Patrick Farrell 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") Signed-off-by: Patrick Farrell Reviewed-on: https://review.whamcloud.com/45888 Reviewed-by: Andreas Dilger Reviewed-by: Sebastien Buisson Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/llite/rw.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/lustre/llite/rw.c b/fs/lustre/llite/rw.c index 239f78b..1c2f027 100644 --- a/fs/lustre/llite/rw.c +++ b/fs/lustre/llite/rw.c @@ -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, From patchwork Sat Jun 18 13:51:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886406 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8452CCA473 for ; Sat, 18 Jun 2022 14:00:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234449AbiFRNxN (ORCPT ); Sat, 18 Jun 2022 09:53:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234351AbiFRNxI (ORCPT ); Sat, 18 Jun 2022 09:53:08 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0236655AD for ; Sat, 18 Jun 2022 06:53:07 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 2B6F113F8; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 29F56DC803; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, Patrick Farrell , James Simmons Subject: [PATCH 17/28] lustre: llite: Add FID to async ra iotrace Date: Sat, 18 Jun 2022 09:51:59 -0400 Message-Id: <1655560330-30743-18-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Patrick Farrell 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") Signed-off-by: Patrick Farrell Reviewed-on: https://review.whamcloud.com/45912 Reviewed-by: Sebastien Buisson Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/llite/rw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/lustre/llite/rw.c b/fs/lustre/llite/rw.c index 1c2f027..c807217 100644 --- a/fs/lustre/llite/rw.c +++ b/fs/lustre/llite/rw.c @@ -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)) { From patchwork Sat Jun 18 13:52:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886408 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE979C433EF for ; Sat, 18 Jun 2022 14:01:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230229AbiFROAt (ORCPT ); Sat, 18 Jun 2022 10:00:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231598AbiFRNxJ (ORCPT ); Sat, 18 Jun 2022 09:53:09 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BE29639D for ; Sat, 18 Jun 2022 06:53:09 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 3010513F9; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 2DCA1E4F1D; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, Patrick Farrell , James Simmons Subject: [PATCH 18/28] lustre: llite: Add COMPLETED iotrace messages Date: Sat, 18 Jun 2022 09:52:00 -0400 Message-Id: <1655560330-30743-19-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Patrick Farrell 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") Signed-off-by: Patrick Farrell Reviewed-on: https://review.whamcloud.com/46484 Reviewed-by: Sebastien Buisson Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/llite/file.c | 12 ++++++++++++ fs/lustre/llite/llite_mmap.c | 12 +++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/fs/lustre/llite/file.c b/fs/lustre/llite/file.c index 5be77e8..efe117d 100644 --- a/fs/lustre/llite/file.c +++ b/fs/lustre/llite/file.c @@ -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; } diff --git a/fs/lustre/llite/llite_mmap.c b/fs/lustre/llite/llite_mmap.c index 2e762b1..4acc7ee 100644 --- a/fs/lustre/llite/llite_mmap.c +++ b/fs/lustre/llite/llite_mmap.c @@ -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; } From patchwork Sat Jun 18 13:52:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886409 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 129DCCCA480 for ; Sat, 18 Jun 2022 14:01:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232528AbiFROAt (ORCPT ); Sat, 18 Jun 2022 10:00:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233500AbiFRNxM (ORCPT ); Sat, 18 Jun 2022 09:53:12 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40B8664F4 for ; Sat, 18 Jun 2022 06:53:10 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 365AC13FA; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 318CBE9152; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, Patrick Farrell , James Simmons Subject: [PATCH 19/28] lustre: osc: Add RPC to iotrace Date: Sat, 18 Jun 2022 09:52:01 -0400 Message-Id: <1655560330-30743-20-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Patrick Farrell 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") Signed-off-by: Patrick Farrell Reviewed-on: https://review.whamcloud.com/45894 Reviewed-by: Sebastien Buisson Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/osc/osc_request.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/fs/lustre/osc/osc_request.c b/fs/lustre/osc/osc_request.c index 124d3c57..d84884f 100644 --- a/fs/lustre/osc/osc_request.c +++ b/fs/lustre/osc/osc_request.c @@ -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); From patchwork Sat Jun 18 13:52:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886411 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F12EDCCA473 for ; Sat, 18 Jun 2022 14:01:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233897AbiFROAu (ORCPT ); Sat, 18 Jun 2022 10:00:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234641AbiFRNxP (ORCPT ); Sat, 18 Jun 2022 09:53:15 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE1CD6430 for ; Sat, 18 Jun 2022 06:53:13 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 39B3313FB; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 35524FD3BF; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, James Simmons Subject: [PATCH 20/28] lnet: libcfs: add "default" keyword for debug mask Date: Sat, 18 Jun 2022 09:52:02 -0400 Message-Id: <1655560330-30743-21-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Andreas Dilger 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") Signed-off-by: Andreas Dilger Reviewed-on: https://review.whamcloud.com/46251 Reviewed-by: Jian Yu Reviewed-by: Arshad Hussain Reviewed-by: Neil Brown Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- 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(-) diff --git a/include/linux/libcfs/libcfs_string.h b/include/linux/libcfs/libcfs_string.h index e2b6d72..a8bd44d 100644 --- a/include/linux/libcfs/libcfs_string.h +++ b/include/linux/libcfs/libcfs_string.h @@ -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); diff --git a/include/uapi/linux/lnet/libcfs_debug.h b/include/uapi/linux/lnet/libcfs_debug.h index bbd9f25..ba87912 100644 --- a/include/uapi/linux/lnet/libcfs_debug.h +++ b/include/uapi/linux/lnet/libcfs_debug.h @@ -62,38 +62,41 @@ struct ptldebug_header { #define PH_FLAG_FIRST_RECORD 1 /* Debugging subsystems (32 bits, non-overlapping) */ -#define S_UNDEFINED 0x00000001 -#define S_MDC 0x00000002 -#define S_MDS 0x00000004 -#define S_OSC 0x00000008 -#define S_OST 0x00000010 -#define S_CLASS 0x00000020 -#define S_LOG 0x00000040 -#define S_LLITE 0x00000080 -#define S_RPC 0x00000100 -#define S_MGMT 0x00000200 -#define S_LNET 0x00000400 -#define S_LND 0x00000800 /* ALL LNDs */ -#define S_PINGER 0x00001000 -#define S_FILTER 0x00002000 -#define S_LIBCFS 0x00004000 -#define S_ECHO 0x00008000 -#define S_LDLM 0x00010000 -#define S_LOV 0x00020000 -#define S_LQUOTA 0x00040000 -#define S_OSD 0x00080000 -#define S_LFSCK 0x00100000 -#define S_SNAPSHOT 0x00200000 +enum libcfs_debug_subsys { + S_UNDEFINED = 0x00000001, + S_MDC = 0x00000002, + S_MDS = 0x00000004, + S_OSC = 0x00000008, + S_OST = 0x00000010, + S_CLASS = 0x00000020, + S_LOG = 0x00000040, + S_LLITE = 0x00000080, + S_RPC = 0x00000100, + S_MGMT = 0x00000200, + S_LNET = 0x00000400, + S_LND = 0x00000800, /* ALL LNDs */ + S_PINGER = 0x00001000, + S_FILTER = 0x00002000, + S_LIBCFS = 0x00004000, + S_ECHO = 0x00008000, + S_LDLM = 0x00010000, + S_LOV = 0x00020000, + S_LQUOTA = 0x00040000, + S_OSD = 0x00080000, + S_LFSCK = 0x00100000, + S_SNAPSHOT = 0x00200000, /* unused */ -#define S_LMV 0x00800000 /* b_new_cmd */ + S_LMV = 0x00800000, /* unused */ -#define S_SEC 0x02000000 /* upcall cache */ -#define S_GSS 0x04000000 /* b_new_cmd */ + S_SEC = 0x02000000, /* upcall cache */ + S_GSS = 0x04000000, /* unused */ -#define S_MGC 0x10000000 -#define S_MGS 0x20000000 -#define S_FID 0x40000000 /* b_new_cmd */ -#define S_FLD 0x80000000 /* b_new_cmd */ + S_MGC = 0x10000000, + S_MGS = 0x20000000, + S_FID = 0x40000000, + S_FLD = 0x80000000, +}; +#define LIBCFS_S_DEFAULT (~0) #define LIBCFS_DEBUG_SUBSYS_NAMES { \ "undefined", "mdc", "mds", "osc", "ost", "class", "log", \ @@ -103,38 +106,42 @@ struct ptldebug_header { "fid", "fld", NULL } /* Debugging masks (32 bits, non-overlapping) */ -#define D_TRACE 0x00000001 /* ENTRY/EXIT markers */ -#define D_INODE 0x00000002 -#define D_SUPER 0x00000004 -#define D_IOTRACE 0x00000008 /* simple, low overhead io tracing */ -#define D_MALLOC 0x00000010 /* print malloc, free information */ -#define D_CACHE 0x00000020 /* cache-related items */ -#define D_INFO 0x00000040 /* general information */ -#define D_IOCTL 0x00000080 /* ioctl related information */ -#define D_NETERROR 0x00000100 /* network errors */ -#define D_NET 0x00000200 /* network communications */ -#define D_WARNING 0x00000400 /* CWARN(...) == CDEBUG (D_WARNING, ...) */ -#define D_BUFFS 0x00000800 -#define D_OTHER 0x00001000 -#define D_DENTRY 0x00002000 -#define D_NETTRACE 0x00004000 -#define D_PAGE 0x00008000 /* bulk page handling */ -#define D_DLMTRACE 0x00010000 -#define D_ERROR 0x00020000 /* CERROR(...) == CDEBUG (D_ERROR, ...) */ -#define D_EMERG 0x00040000 /* CEMERG(...) == CDEBUG (D_EMERG, ...) */ -#define D_HA 0x00080000 /* recovery and failover */ -#define D_RPCTRACE 0x00100000 /* for distributed debugging */ -#define D_VFSTRACE 0x00200000 -#define D_READA 0x00400000 /* read-ahead */ -#define D_MMAP 0x00800000 -#define D_CONFIG 0x01000000 -#define D_CONSOLE 0x02000000 -#define D_QUOTA 0x04000000 -#define D_SEC 0x08000000 -#define D_LFSCK 0x10000000 /* For both OI scrub and LFSCK */ -#define D_HSM 0x20000000 -#define D_SNAPSHOT 0x40000000 /* snapshot */ -#define D_LAYOUT 0x80000000 +enum libcfs_debug_masks { + D_TRACE = 0x00000001, /* ENTRY/EXIT markers */ + D_INODE = 0x00000002, + D_SUPER = 0x00000004, + D_IOTRACE = 0x00000008, /* simple, low overhead io tracing */ + D_MALLOC = 0x00000010, /* print malloc, free information */ + D_CACHE = 0x00000020, /* cache-related items */ + D_INFO = 0x00000040, /* general information */ + D_IOCTL = 0x00000080, /* ioctl related information */ + D_NETERROR = 0x00000100, /* network errors */ + D_NET = 0x00000200, /* network communications */ + D_WARNING = 0x00000400, /* CWARN(...) == CDEBUG(D_WARNING, ...) */ + D_BUFFS = 0x00000800, + D_OTHER = 0x00001000, + D_DENTRY = 0x00002000, + D_NETTRACE = 0x00004000, + D_PAGE = 0x00008000, /* bulk page handling */ + D_DLMTRACE = 0x00010000, + D_ERROR = 0x00020000, /* CERROR(...) == CDEBUG(D_ERROR, ...) */ + D_EMERG = 0x00040000, /* CEMERG(...) == CDEBUG(D_EMERG, ...) */ + D_HA = 0x00080000, /* recovery and failover */ + D_RPCTRACE = 0x00100000, /* for distributed debugging */ + D_VFSTRACE = 0x00200000, + D_READA = 0x00400000, /* read-ahead */ + D_MMAP = 0x00800000, + D_CONFIG = 0x01000000, + D_CONSOLE = 0x02000000, + D_QUOTA = 0x04000000, + D_SEC = 0x08000000, + D_LFSCK = 0x10000000, /* For both OI scrub and LFSCK */ + D_HSM = 0x20000000, + D_SNAPSHOT = 0x40000000, + D_LAYOUT = 0x80000000, +}; +#define LIBCFS_D_DEFAULT (D_CANTMASK | D_NETERROR | D_HA | D_CONFIG | D_IOCTL |\ + D_LFSCK) #define LIBCFS_DEBUG_MASKS_NAMES { \ "trace", "inode", "super", "iotrace", "malloc", "cache", "info",\ diff --git a/net/lnet/libcfs/debug.c b/net/lnet/libcfs/debug.c index 1bb382d..f8ff5f7 100644 --- a/net/lnet/libcfs/debug.c +++ b/net/lnet/libcfs/debug.c @@ -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"; diff --git a/net/lnet/libcfs/libcfs_string.c b/net/lnet/libcfs/libcfs_string.c index 0563c42..672b859 100644 --- a/net/lnet/libcfs/libcfs_string.c +++ b/net/lnet/libcfs/libcfs_string.c @@ -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: [+|-] ...\n", len, str); From patchwork Sat Jun 18 13:52:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886419 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDC3DCCA482 for ; Sat, 18 Jun 2022 14:02:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232419AbiFROBN (ORCPT ); Sat, 18 Jun 2022 10:01:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234886AbiFRNxS (ORCPT ); Sat, 18 Jun 2022 09:53:18 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07C63E6B for ; Sat, 18 Jun 2022 06:53:16 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 3DB9213FC; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 3A3C6DC803; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, James Simmons , Jian Yu Subject: [PATCH 21/28] lustre: uapi: avoid gcc-11 -Werror=stringop-overread warning Date: Sat, 18 Jun 2022 09:52:03 -0400 Message-Id: <1655560330-30743-22-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org 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") Signed-off-by: Jian Yu 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") Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/46319 Reviewed-by: Alexey Lyashkov Reviewed-by: Arshad Hussain Reviewed-by: Patrick Farrell Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- include/uapi/linux/lustre/lustre_user.h | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/include/uapi/linux/lustre/lustre_user.h b/include/uapi/linux/lustre/lustre_user.h index ee789f2..c57929b 100644 --- a/include/uapi/linux/lustre/lustre_user.h +++ b/include/uapi/linux/lustre/lustre_user.h @@ -40,26 +40,27 @@ * * @{ */ +#include +#ifndef __KERNEL__ +# define __USE_ISOC99 1 +# include +# include /* snprintf() */ +# include + +# define __USE_GNU 1 +# define FILEID_LUSTRE 0x97 /* for name_to_handle_at() (and llapi_fd2fid()) */ +#endif /* !__KERNEL__ */ #include #include #include #include -#include #include #include #include #include #include -#ifndef __KERNEL__ -# define __USE_ISOC99 1 -# include -# include /* snprintf() */ -# include -# 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); From patchwork Sat Jun 18 13:52:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886418 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDD2ACCA483 for ; Sat, 18 Jun 2022 14:02:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233500AbiFROBO (ORCPT ); Sat, 18 Jun 2022 10:01:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235115AbiFRNxT (ORCPT ); Sat, 18 Jun 2022 09:53:19 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87D51AE7F for ; Sat, 18 Jun 2022 06:53:18 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 40FF213FD; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 3E232E4F1D; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, Alexander Boyko , James Simmons Subject: [PATCH 22/28] lustre: lmv: skip qos for qos_threshold_rr=100 Date: Sat, 18 Jun 2022 09:52:04 -0400 Message-Id: <1655560330-30743-23-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Alexander Boyko 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") Signed-off-by: Alexander Boyko Reviewed-on: https://review.whamcloud.com/46388 Reviewed-by: Andrew Perepechko Reviewed-by: Alexey Lyashkov Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- 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(-) diff --git a/fs/lustre/include/lu_object.h b/fs/lustre/include/lu_object.h index 3fb40c6..e4dd287c5 100644 --- a/fs/lustre/include/lu_object.h +++ b/fs/lustre/include/lu_object.h @@ -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; diff --git a/fs/lustre/lmv/lproc_lmv.c b/fs/lustre/lmv/lproc_lmv.c index b9efae9..6d4e8d9 100644 --- a/fs/lustre/lmv/lproc_lmv.c +++ b/fs/lustre/lmv/lproc_lmv.c @@ -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; diff --git a/fs/lustre/obdclass/lu_tgt_descs.c b/fs/lustre/obdclass/lu_tgt_descs.c index 935cff6..51d2e21 100644 --- a/fs/lustre/obdclass/lu_tgt_descs.c +++ b/fs/lustre/obdclass/lu_tgt_descs.c @@ -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); From patchwork Sat Jun 18 13:52:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886410 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF6DBCCA47C for ; Sat, 18 Jun 2022 14:01:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234228AbiFROAv (ORCPT ); Sat, 18 Jun 2022 10:00:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235271AbiFRNxV (ORCPT ); Sat, 18 Jun 2022 09:53:21 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AECC3AD for ; Sat, 18 Jun 2022 06:53:20 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 484FF13FE; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 43A4AE9152; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, Chris Horn , James Simmons Subject: [PATCH 23/28] lnet: Ping buffer ref leak in lnet_peer_data_present Date: Sat, 18 Jun 2022 09:52:05 -0400 Message-Id: <1655560330-30743-24-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Chris Horn 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") Signed-off-by: Chris Horn Reviewed-on: https://review.whamcloud.com/46431 Reviewed-by: Andriy Skulysh Reviewed-by: James Simmons Reviewed-by: Serguei Smirnov Reviewed-by: Cyril Bordage Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- net/lnet/lnet/peer.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/net/lnet/lnet/peer.c b/net/lnet/lnet/peer.c index 57d137c..3909c5d 100644 --- a/net/lnet/lnet/peer.c +++ b/net/lnet/lnet/peer.c @@ -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); } From patchwork Sat Jun 18 13:52:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886416 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E78ECCA481 for ; Sat, 18 Jun 2022 14:02:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350560AbiFROAx (ORCPT ); Sat, 18 Jun 2022 10:00:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235656AbiFRNxW (ORCPT ); Sat, 18 Jun 2022 09:53:22 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFE89DEA6 for ; Sat, 18 Jun 2022 06:53:21 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 4AA8D13FF; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 47A00FD3BF; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, Chris Horn , James Simmons Subject: [PATCH 24/28] lnet: DLC sets map_on_demand incorrectly Date: Sat, 18 Jun 2022 09:52:06 -0400 Message-Id: <1655560330-30743-25-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Chris Horn 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") Signed-off-by: Chris Horn Reviewed-on: https://review.whamcloud.com/46492 Reviewed-by: James Simmons Reviewed-by: Serguei Smirnov Reviewed-by: Cyril Bordage Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- net/lnet/klnds/o2iblnd/o2iblnd_modparams.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/lnet/klnds/o2iblnd/o2iblnd_modparams.c b/net/lnet/klnds/o2iblnd/o2iblnd_modparams.c index 022ed02..04286e1 100644 --- a/net/lnet/klnds/o2iblnd/o2iblnd_modparams.c +++ b/net/lnet/klnds/o2iblnd/o2iblnd_modparams.c @@ -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 From patchwork Sat Jun 18 13:52:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886412 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2487BCCA482 for ; Sat, 18 Jun 2022 14:01:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234268AbiFROAv (ORCPT ); Sat, 18 Jun 2022 10:00:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235992AbiFRNx2 (ORCPT ); Sat, 18 Jun 2022 09:53:28 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7688DFB6 for ; Sat, 18 Jun 2022 06:53:22 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 4ED7C1E88; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 4D03ADC803; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, Chris Horn , James Simmons Subject: [PATCH 25/28] lnet: Return ESHUTDOWN in lnet_parse() Date: Sat, 18 Jun 2022 09:52:07 -0400 Message-Id: <1655560330-30743-26-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Chris Horn 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()") Signed-off-by: Chris Horn Reviewed-on: https://review.whamcloud.com/46711 Reviewed-by: Cyril Bordage Reviewed-by: Andriy Skulysh Reviewed-by: Serguei Smirnov Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- net/lnet/lnet/lib-move.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/lnet/lnet/lib-move.c b/net/lnet/lnet/lib-move.c index 9ee1075..0c5bf82 100644 --- a/net/lnet/lnet/lib-move.c +++ b/net/lnet/lnet/lib-move.c @@ -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; } From patchwork Sat Jun 18 13:52:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886413 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D550C433EF for ; Sat, 18 Jun 2022 14:02:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236954AbiFROAw (ORCPT ); Sat, 18 Jun 2022 10:00:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236309AbiFRNx3 (ORCPT ); Sat, 18 Jun 2022 09:53:29 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E61610572 for ; Sat, 18 Jun 2022 06:53:25 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 5434C1E89; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 51BB9E4F1D; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, "John L. Hammond" , James Simmons Subject: [PATCH 26/28] lustre: lov: remove lov_page Date: Sat, 18 Jun 2022 09:52:08 -0400 Message-Id: <1655560330-30743-27-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: "John L. Hammond" 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") Signed-off-by: John L. Hammond Reviewed-on: https://review.whamcloud.com/47221 Reviewed-by: Patrick Farrell Reviewed-by: Bobi Jam Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- 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(-) diff --git a/fs/lustre/include/cl_object.h b/fs/lustre/include/cl_object.h index 06f03b4..5be89d6 100644 --- a/fs/lustre/include/cl_object.h +++ b/fs/lustre/include/cl_object.h @@ -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 diff --git a/fs/lustre/lov/lov_cl_internal.h b/fs/lustre/lov/lov_cl_internal.h index 6b96543..95dbb43 100644 --- a/fs/lustre/lov/lov_cl_internal.h +++ b/fs/lustre/lov/lov_cl_internal.h @@ -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) { diff --git a/fs/lustre/lov/lov_object.c b/fs/lustre/lov/lov_object.c index d9eaf15..3934a98 100644 --- a/fs/lustre/lov/lov_object.c +++ b/fs/lustre/lov/lov_object.c @@ -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) { diff --git a/fs/lustre/lov/lov_page.c b/fs/lustre/lov/lov_page.c index 16bd7cd..bd6ba79 100644 --- a/fs/lustre/lov/lov_page.c +++ b/fs/lustre/lov/lov_page.c @@ -39,6 +39,8 @@ #include #include "lov_cl_internal.h" +#include +#include /** \addtogroup lov * @{ @@ -49,20 +51,6 @@ * Lov page operations. * */ -static int lov_comp_page_print(const struct lu_env *env, - const struct cl_page_slice *slice, - void *cookie, lu_printer_t printer) -{ - struct lov_page *lp = cl2lov_page(slice); - - return (*printer)(env, cookie, - LUSTRE_LOV_NAME"-page@%p\n", lp); -} - -static const struct cl_page_operations lov_comp_page_ops = { - .cpo_print = lov_comp_page_print -}; - int lov_page_init_composite(const struct lu_env *env, struct cl_object *obj, struct cl_page *page, pgoff_t index) { @@ -72,7 +60,6 @@ int lov_page_init_composite(const struct lu_env *env, struct cl_object *obj, struct cl_object *subobj; struct cl_object *o; struct lov_io_sub *sub; - struct lov_page *lpg = cl_object_page_slice(obj, page); bool stripe_cached = false; u64 offset; u64 suboff; @@ -118,7 +105,7 @@ int lov_page_init_composite(const struct lu_env *env, struct cl_object *obj, offset, entry, stripe, suboff); page->cp_lov_index = lov_comp_index(entry, stripe); - cl_page_slice_add(page, &lpg->lps_cl, obj, &lov_comp_page_ops); + LASSERT(page->cp_lov_index != CP_LOV_INDEX_EMPTY); if (!stripe_cached) { sub = lov_sub_get(env, lio, page->cp_lov_index); @@ -146,28 +133,14 @@ int lov_page_init_composite(const struct lu_env *env, struct cl_object *obj, return rc; } -static int lov_empty_page_print(const struct lu_env *env, - const struct cl_page_slice *slice, - void *cookie, lu_printer_t printer) -{ - struct lov_page *lp = cl2lov_page(slice); - - return (*printer)(env, cookie, LUSTRE_LOV_NAME "-page@%p, empty.\n", - lp); -} - -static const struct cl_page_operations lov_empty_page_ops = { - .cpo_print = lov_empty_page_print -}; - int lov_page_init_empty(const struct lu_env *env, struct cl_object *obj, struct cl_page *page, pgoff_t index) { - struct lov_page *lpg = cl_object_page_slice(obj, page); void *addr; - page->cp_lov_index = ~0; - cl_page_slice_add(page, &lpg->lps_cl, obj, &lov_empty_page_ops); + BUILD_BUG_ON(!__same_type(page->cp_lov_index, CP_LOV_INDEX_EMPTY)); + page->cp_lov_index = CP_LOV_INDEX_EMPTY; + addr = kmap(page->cp_vmpage); memset(addr, 0, cl_page_size(obj)); kunmap(page->cp_vmpage); @@ -182,11 +155,4 @@ int lov_page_init_foreign(const struct lu_env *env, struct cl_object *obj, return -ENODATA; } -bool lov_page_is_empty(const struct cl_page *page) -{ - const struct cl_page_slice *slice = cl_page_at(page, &lov_device_type); - - LASSERT(slice); - return slice->cpl_ops == &lov_empty_page_ops; -} /** @} lov */ From patchwork Sat Jun 18 13:52:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886414 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D4D6CCA473 for ; Sat, 18 Jun 2022 14:02:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350572AbiFROAx (ORCPT ); Sat, 18 Jun 2022 10:00:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236772AbiFRNxc (ORCPT ); Sat, 18 Jun 2022 09:53:32 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11A5D13D21 for ; Sat, 18 Jun 2022 06:53:27 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 5ADDD1E8B; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 55ABDE9152; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, Chris Horn , James Simmons Subject: [PATCH 27/28] lnet: libcfs: libcfs_debug_mb set incorrectly on init Date: Sat, 18 Jun 2022 09:52:09 -0400 Message-Id: <1655560330-30743-28-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Chris Horn 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") Signed-off-by: Chris Horn Reviewed-on: https://review.whamcloud.com/46925 Reviewed-by: Neil Brown Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- net/lnet/libcfs/debug.c | 9 +++------ net/lnet/libcfs/tracefile.c | 5 ++++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/net/lnet/libcfs/debug.c b/net/lnet/libcfs/debug.c index f8ff5f7..c00e6da 100644 --- a/net/lnet/libcfs/debug.c +++ b/net/lnet/libcfs/debug.c @@ -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; } diff --git a/net/lnet/libcfs/tracefile.c b/net/lnet/libcfs/tracefile.c index 948eaaa..f0b7a2e 100644 --- a/net/lnet/libcfs/tracefile.c +++ b/net/lnet/libcfs/tracefile.c @@ -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) From patchwork Sat Jun 18 13:52:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12886417 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E580CCA47C for ; Sat, 18 Jun 2022 14:02:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350581AbiFROAy (ORCPT ); Sat, 18 Jun 2022 10:00:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237024AbiFRNxd (ORCPT ); Sat, 18 Jun 2022 09:53:33 -0400 Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD8B8D108 for ; Sat, 18 Jun 2022 06:53:29 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 5C0D81E8D; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 59C94FD3BF; Sat, 18 Jun 2022 09:52:14 -0400 (EDT) From: James Simmons To: Eric Biggers , Andreas Dilger , NeilBrown Cc: linux-fscrypt@vger.kernel.org, Alex Zhuravlev , James Simmons Subject: [PATCH 28/28] lustre: ptlrpc: don't report eviction for light weigth connections Date: Sat, 18 Jun 2022 09:52:10 -0400 Message-Id: <1655560330-30743-29-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> References: <1655560330-30743-1-git-send-email-jsimmons@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org From: Alex Zhuravlev 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") Signed-off-by: Alex Zhuravlev Reviewed-on: https://review.whamcloud.com/47374 Reviewed-by: Andreas Dilger Reviewed-by: Mike Pershin Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/ptlrpc/import.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/lustre/ptlrpc/import.c b/fs/lustre/ptlrpc/import.c index d685b96..a5fdb8a8 100644 --- a/fs/lustre/ptlrpc/import.c +++ b/fs/lustre/ptlrpc/import.c @@ -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,