Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4678977pxu; Wed, 21 Oct 2020 02:28:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3cX6KpFFxhupQ0QsGYU0aesXBRc9ErT1h6ouXJyMuvMdrlnq+xvmIOLQDbDOB+mrya2Ob X-Received: by 2002:a05:6402:384:: with SMTP id o4mr2144098edv.387.1603272526479; Wed, 21 Oct 2020 02:28:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603272526; cv=none; d=google.com; s=arc-20160816; b=YotyqdKCWQYoEGu3xUeNJhuIcEVszIHT/JKWf/I2d2D+NEvhKOcQobXh+YXoRXUzvX 2+8F4BeFbVHL+tgYXHoFUMlScbTPNGzAXjfoDjYVCr7E6QRsR8fks7qlZND6IVlC2vco /pCWdyaEi+sbrEDUL0+WXnXybD69XQwP0CuO93A6VhWy5thRVv9qg8I0q5noxS0TV4yJ puPf0qCbAzvmKGMAWuS5cZgISG3Iw9pcUVAxE7GAMoeRtzuPJNV49y8ZiY1X/9jylPgX lR/OWxTOzT/A2Qkos6rlWYTs7S9E3AivFtIjCBzScRFTdUt43sT7FN4sAZsF7UPH/IPF 56tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=kiRUcMuSoGEsfd3+9ckAuua0fc2BE8nNhLHmAOqHc4M=; b=H5Fk8CeXbEnwFggtXWKzXFKQqAD8bGu9h1jUhB3szjVO1kW+s0jr6XuqJ+XHfR9R9+ spq/+ZgwcPSg/nYwZV/6nTN/ghzsHtQ870j2mAU9YWVWwHTgviJ4/DfxN70NNtNYbhC9 EHnIyfXVRPDSvUJ1lAJ4odNdI7juK/wEyPOGCuF/tTqMO5Yrwo7icVAYmxMqFYaeAT2p FzUyctGWdXmm7IrWElzS7p2dmsKrFQlOQ6Dqg/jiQz7i9Qu4oLWsrkwJRCdSqK2aF5zH e376jH/bCV9WVQ0Fzr6iBuyQtKdnS2mLMbO3PxKee7pbY/RK/wRH6lXACRowXkMuTyc4 hncA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d2si1011417ejm.716.2020.10.21.02.28.23; Wed, 21 Oct 2020 02:28:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438038AbgJTTQG (ORCPT + 99 others); Tue, 20 Oct 2020 15:16:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438032AbgJTTQG (ORCPT ); Tue, 20 Oct 2020 15:16:06 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF7EDC0613CE; Tue, 20 Oct 2020 12:16:05 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id B09FF1F44C3F From: Gabriel Krisman Bertazi To: dhowells@redhat.com Cc: viro@zeniv.linux.org.uk, tytso@mit.edu, khazhy@google.com, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, Gabriel Krisman Bertazi , kernel@collabora.com Subject: [PATCH RFC 5/7] vfs: Include origin of the SB error notification Date: Tue, 20 Oct 2020 15:15:41 -0400 Message-Id: <20201020191543.601784-6-krisman@collabora.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201020191543.601784-1-krisman@collabora.com> References: <20201020191543.601784-1-krisman@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org When reporting a filesystem error, we really need to know where the error came from, therefore, include "function:line" information in the notification sent to userspace. There is no current users of notify_sb in the kernel, so there are no callers to update. Signed-off-by: Gabriel Krisman Bertazi --- include/linux/fs.h | 10 ++++++++-- include/uapi/linux/watch_queue.h | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index d24905e10623..be9f7b480f50 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3516,12 +3516,14 @@ static inline void notify_sb(struct super_block *s, /** * notify_sb_error: Post superblock error notification. * @s: The superblock the notification is about. + * @function: function name reported as source of the warning. + * @line: source code line reported as source of the warning. * @error: The error number to be recorded. * @fmt: Formating string for extra information appended to the notification * @args: arguments for extra information string appended to the notification */ -static inline int notify_sb_error(struct super_block *s, int error, - const char *fmt, va_list *args) +static inline int notify_sb_error(struct super_block *s, const char *function, + int line, int error, const char *fmt, va_list *args) { #ifdef CONFIG_SB_NOTIFICATIONS if (unlikely(s->s_watchers)) { @@ -3532,8 +3534,12 @@ static inline int notify_sb_error(struct super_block *s, int error, .s.sb_id = s->s_unique_id, .error_number = error, .error_cookie = 0, + .line = line, }; + memcpy(&n.function, function, SB_NOTIFICATION_FNAME_LEN); + n.function[SB_NOTIFICATION_FNAME_LEN-1] = '\0'; + post_sb_notification(s, &n.s, fmt, args); } #endif diff --git a/include/uapi/linux/watch_queue.h b/include/uapi/linux/watch_queue.h index 5899936534f4..d0a45a4ded7d 100644 --- a/include/uapi/linux/watch_queue.h +++ b/include/uapi/linux/watch_queue.h @@ -114,6 +114,7 @@ enum superblock_notification_type { #define NOTIFY_SUPERBLOCK_IS_NOW_RO WATCH_INFO_FLAG_0 /* Superblock changed to R/O */ +#define SB_NOTIFICATION_FNAME_LEN 30 /* * Superblock notification record. * - watch.type = WATCH_TYPE_MOUNT_NOTIFY @@ -128,6 +129,8 @@ struct superblock_error_notification { struct superblock_notification s; /* subtype = notify_superblock_error */ __u32 error_number; __u32 error_cookie; + char function[SB_NOTIFICATION_FNAME_LEN]; + __u16 line; char desc[0]; }; -- 2.28.0