From patchwork Thu Feb 27 21:14:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11410415 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0BA8117E0 for ; Thu, 27 Feb 2020 21:37:49 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E8BA124690 for ; Thu, 27 Feb 2020 21:37:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E8BA124690 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lustre-devel-bounces@lists.lustre.org Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 3D42734A2D5; Thu, 27 Feb 2020 13:31:02 -0800 (PST) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 9FCA821FC2C for ; Thu, 27 Feb 2020 13:20:15 -0800 (PST) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id B92AA8AB0; Thu, 27 Feb 2020 16:18:17 -0500 (EST) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id B81B246A; Thu, 27 Feb 2020 16:18:17 -0500 (EST) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Thu, 27 Feb 2020 16:14:05 -0500 Message-Id: <1582838290-17243-378-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> References: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 377/622] lustre: llite: console message for disabled flock call X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Li Xi , Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Li Xi When flock option is disabled on a Lustre client, any call to flock() or lockf() would cause a return value with failure. For applications that don't print proper error message, it is hard to know the root cause is the missing flock option on Lustre file system. Thus this patch prints following error message to the tty that calls flock()/lockf(): "Lustre: flock disabled, mount with '-o [local]flock' to enable" Such message will print to each file descriptor no more than once to avoid message flood. In order to do so, this patch adds support for CDEBUG_LIMIT(D_TTY). It prints the message to tty. When using this macro, please note that "\r\n" needs to be the end of the line. Otherwise, message like "format at $FILE:$LINO:$FUNC doesn't end in '\r\n'" will be printed to the system message for warning. Note that LL_FILE_RMTACL should have been removed by Commit 341f1f0affed ("staging: lustre: remove remote client support") WC-bug-id: https://jira.whamcloud.com/browse/LU-12349 Lustre-commit: f6497eb3503b ("LU-12349 llite: console message for disabled flock call") Signed-off-by: Li Xi Reviewed-on: https://review.whamcloud.com/34986 Reviewed-by: Andreas Dilger Reviewed-by: Yingjin Qian Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/llite/file.c | 12 ++++++++++++ include/uapi/linux/lnet/libcfs_debug.h | 4 ++-- include/uapi/linux/lustre/lustre_user.h | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/fs/lustre/llite/file.c b/fs/lustre/llite/file.c index 1ed4b14..76a5074 100644 --- a/fs/lustre/llite/file.c +++ b/fs/lustre/llite/file.c @@ -4275,6 +4275,18 @@ int ll_migrate(struct inode *parent, struct file *file, struct lmv_user_md *lum, static int ll_file_noflock(struct file *file, int cmd, struct file_lock *file_lock) { + struct ll_file_data *fd = LUSTRE_FPRIVATE(file); + + /* + * In order to avoid flood of warning messages, only print one message + * for one file. And the entire message rate on the client is limited + * by CDEBUG_LIMIT too. + */ + if (!(fd->fd_flags & LL_FILE_FLOCK_WARNING)) { + fd->fd_flags |= LL_FILE_FLOCK_WARNING; + CDEBUG_LIMIT(D_TTY | D_CONSOLE, + "flock disabled, mount with '-o [local]flock' to enable\r\n"); + } return -EINVAL; } diff --git a/include/uapi/linux/lnet/libcfs_debug.h b/include/uapi/linux/lnet/libcfs_debug.h index 1a68667..6255331 100644 --- a/include/uapi/linux/lnet/libcfs_debug.h +++ b/include/uapi/linux/lnet/libcfs_debug.h @@ -106,7 +106,7 @@ struct ptldebug_header { #define D_TRACE 0x00000001 /* ENTRY/EXIT markers */ #define D_INODE 0x00000002 #define D_SUPER 0x00000004 -#define D_EXT2 0x00000008 /* anything from ext2_debug */ +#define D_TTY 0x00000008 /* notification printed to TTY */ #define D_MALLOC 0x00000010 /* print malloc, free information */ #define D_CACHE 0x00000020 /* cache-related items */ #define D_INFO 0x00000040 /* general information */ @@ -137,7 +137,7 @@ struct ptldebug_header { #define D_LAYOUT 0x80000000 #define LIBCFS_DEBUG_MASKS_NAMES { \ - "trace", "inode", "super", "ext2", "malloc", "cache", "info", \ + "trace", "inode", "super", "tty", "malloc", "cache", "info", \ "ioctl", "neterror", "net", "warning", "buffs", "other", \ "dentry", "nettrace", "page", "dlmtrace", "error", "emerg", \ "ha", "rpctrace", "vfstrace", "reada", "mmap", "config", \ diff --git a/include/uapi/linux/lustre/lustre_user.h b/include/uapi/linux/lustre/lustre_user.h index 317b236..d43170f 100644 --- a/include/uapi/linux/lustre/lustre_user.h +++ b/include/uapi/linux/lustre/lustre_user.h @@ -385,7 +385,7 @@ struct ll_ioc_lease_id { #define LL_FILE_READAHEA 0x00000004 #define LL_FILE_LOCKED_DIRECTIO 0x00000008 /* client-side locks with dio */ #define LL_FILE_LOCKLESS_IO 0x00000010 /* server-side locks with cio */ -#define LL_FILE_RMTACL 0x00000020 +#define LL_FILE_FLOCK_WARNING 0x00000020 /* warned about disabled flock */ #define LOV_USER_MAGIC_V1 0x0BD10BD0 #define LOV_USER_MAGIC LOV_USER_MAGIC_V1