From patchwork Thu Feb 27 21:11:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11410271 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 8333E92A for ; Thu, 27 Feb 2020 21:33:52 +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 6BE1324677 for ; Thu, 27 Feb 2020 21:33:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6BE1324677 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 A109C349DD0; Thu, 27 Feb 2020 13:28:41 -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 9F76621FB94 for ; Thu, 27 Feb 2020 13:19:16 -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 8D87D24BC; Thu, 27 Feb 2020 16:18:15 -0500 (EST) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 8C1D746C; Thu, 27 Feb 2020 16:18:15 -0500 (EST) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Thu, 27 Feb 2020 16:11:01 -0500 Message-Id: <1582838290-17243-194-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 193/622] lustre: sysfs: make ping sysfs file read and writable 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: James Simmons , Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" Starting with 4.15 kernels any sysfs read only is limited to root access only. To retain the ability for non root users to detect if a remote server is alive using the 'ping' sysfs file we need to change it to writable. Retain the read ability so older tools will work. WC-bug-id: https://jira.whamcloud.com/browse/LU-8066 Lustre-commit: 6bbae72c6900 ("LU-8066 sysfs: make ping sysfs file read and writable") Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/33776 Reviewed-by: Andreas Dilger Reviewed-by: Bobi Jam Signed-off-by: James Simmons --- fs/lustre/include/lprocfs_status.h | 3 ++- fs/lustre/mdc/lproc_mdc.c | 2 +- fs/lustre/mgc/lproc_mgc.c | 2 +- fs/lustre/osc/lproc_osc.c | 2 +- fs/lustre/ptlrpc/lproc_ptlrpc.c | 9 +++++++++ 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/fs/lustre/include/lprocfs_status.h b/fs/lustre/include/lprocfs_status.h index 1ef548ae..c1079f1 100644 --- a/fs/lustre/include/lprocfs_status.h +++ b/fs/lustre/include/lprocfs_status.h @@ -462,7 +462,8 @@ int lprocfs_wr_uint(struct file *file, const char __user *buffer, struct adaptive_timeout; int lprocfs_at_hist_helper(struct seq_file *m, struct adaptive_timeout *at); int lprocfs_rd_timeouts(struct seq_file *m, void *data); - +ssize_t ping_store(struct kobject *kobj, struct attribute *attr, + const char *buffer, size_t count); ssize_t ping_show(struct kobject *kobj, struct attribute *attr, char *buffer); diff --git a/fs/lustre/mdc/lproc_mdc.c b/fs/lustre/mdc/lproc_mdc.c index 746dd21..70c9eaf 100644 --- a/fs/lustre/mdc/lproc_mdc.c +++ b/fs/lustre/mdc/lproc_mdc.c @@ -306,7 +306,7 @@ static ssize_t max_mod_rpcs_in_flight_store(struct kobject *kobj, LUSTRE_ATTR(mds_conn_uuid, 0444, conn_uuid_show, NULL); LUSTRE_RO_ATTR(conn_uuid); -LUSTRE_RO_ATTR(ping); +LUSTRE_RW_ATTR(ping); static ssize_t mdc_rpc_stats_seq_write(struct file *file, const char __user *buf, diff --git a/fs/lustre/mgc/lproc_mgc.c b/fs/lustre/mgc/lproc_mgc.c index 676d479..0c716df 100644 --- a/fs/lustre/mgc/lproc_mgc.c +++ b/fs/lustre/mgc/lproc_mgc.c @@ -69,7 +69,7 @@ struct lprocfs_vars lprocfs_mgc_obd_vars[] = { LUSTRE_ATTR(mgs_conn_uuid, 0444, conn_uuid_show, NULL); LUSTRE_RO_ATTR(conn_uuid); -LUSTRE_RO_ATTR(ping); +LUSTRE_RW_ATTR(ping); static struct attribute *mgc_attrs[] = { &lustre_attr_mgs_conn_uuid.attr, diff --git a/fs/lustre/osc/lproc_osc.c b/fs/lustre/osc/lproc_osc.c index ac64724..ea67d20 100644 --- a/fs/lustre/osc/lproc_osc.c +++ b/fs/lustre/osc/lproc_osc.c @@ -176,7 +176,7 @@ static ssize_t max_dirty_mb_store(struct kobject *kobj, LUSTRE_ATTR(ost_conn_uuid, 0444, conn_uuid_show, NULL); LUSTRE_RO_ATTR(conn_uuid); -LUSTRE_RO_ATTR(ping); +LUSTRE_RW_ATTR(ping); static int osc_cached_mb_seq_show(struct seq_file *m, void *v) { diff --git a/fs/lustre/ptlrpc/lproc_ptlrpc.c b/fs/lustre/ptlrpc/lproc_ptlrpc.c index eb0ecc0..700e109 100644 --- a/fs/lustre/ptlrpc/lproc_ptlrpc.c +++ b/fs/lustre/ptlrpc/lproc_ptlrpc.c @@ -1234,6 +1234,7 @@ void ptlrpc_lprocfs_unregister_obd(struct obd_device *obd) } EXPORT_SYMBOL(ptlrpc_lprocfs_unregister_obd); +/* Kept for older tools */ ssize_t ping_show(struct kobject *kobj, struct attribute *attr, char *buffer) { @@ -1260,6 +1261,14 @@ ssize_t ping_show(struct kobject *kobj, struct attribute *attr, } EXPORT_SYMBOL(ping_show); +ssize_t ping_store(struct kobject *kobj, struct attribute *attr, + const char *buffer, size_t count) +{ + return ping_show(kobj, attr, (char *)buffer); +} +EXPORT_SYMBOL(ping_store); + + #undef BUFLEN /* Write the connection UUID to this file to attempt to connect to that node.