Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp691804pxb; Wed, 11 Nov 2020 13:53:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJyj5LFMnQQHG7Q6zVg/T/9Gb9B8fSKjxasKjwhg++8PVAMZj4ZH7TLwfZy8vuMQyXb6Nqk/ X-Received: by 2002:a05:6402:38f:: with SMTP id o15mr1754460edv.73.1605131607540; Wed, 11 Nov 2020 13:53:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605131607; cv=none; d=google.com; s=arc-20160816; b=SgSr31j8qGp8bpu7SB6c15kildtSZ4LHeXm+Bm6YuaA/W5YUFw+NKH5ddeFf4KqWl3 gq1V0/e/4CEw3eTgNScB2gcS3NTUd/yFSEY+jTgY3owDkbNvPEJkMcTFHCvMeoAiRi1s grTj0bXB50hZv+TmzA0rFwjVacg3+eIqTbzbxKKrxiprnp3Mn1rDOqUtxx3onpsiBoJ2 O77KU/vh9Jvx4DZ0J++75lnsryGqcEK/B4NVeLy6BBiuPtvVXv+TrMeiOlA/CX2X8NwZ cRp9niKAkQlDnF/J8YtUix9ovZyK3buEeehJu2NNBBXuKIUxdb4ZOumLqrBNnW1Znein nY+Q== 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=1hxFciXynqwBR161/1I6wcCN66TGe+eLH8Q/3cZlF2Y=; b=Sg/sjxCUUehNMIA5XqXSVpV8cQ4Vivb6oyjoISHroEWHYEW6WKbPubqA7i7nAi8/hH F9K49sySVPYIPHEXEQk779wQNoXwhGofLJ5+gK8CaXL1Omf0T/HrFq4Zz/9hKai4pv5V UEZGrX5CJAZXw244QQi4lQX1dw1TvSwfEzMkkJQ7aCRu+CxlnWcjqu6aVoM/D/T/oKvI iPblOdiDdhfsqKX5x8kuMg2el2tRPykX73diWIeXBiWLVQJXLFosljDBQa2p2ZWsJWoJ 2MQ29f+vwRgAAkCq0N6yFVGTB3HTky1h0YmooOl9XfZvsILdxZEZQqOCghtY75HrOAGA hixg== 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 y18si2663755edl.592.2020.11.11.13.53.03; Wed, 11 Nov 2020 13:53:27 -0800 (PST) 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 S1726723AbgKKVwo (ORCPT + 99 others); Wed, 11 Nov 2020 16:52:44 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:49794 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726766AbgKKVwo (ORCPT ); Wed, 11 Nov 2020 16:52:44 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id 5BB801F45EB0 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 v2 5/8] vfs: Include origin of the SB error notification Date: Wed, 11 Nov 2020 16:52:10 -0500 Message-Id: <20201111215213.4152354-6-krisman@collabora.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201111215213.4152354-1-krisman@collabora.com> References: <20201111215213.4152354-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 | 11 +++++++++-- include/uapi/linux/watch_queue.h | 3 +++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index cf5245f414c2..81aaa673ada7 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3498,14 +3498,17 @@ 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. * @inode: The inode the error refers to (if available, 0 otherwise) * @block: The block the error refers to (if available, 0 otherwise) * @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, u64 inode, - u64 block, const char *fmt, va_list *args) +static inline int notify_sb_error(struct super_block *s, const char *function, int line, + int error, u64 inode, u64 block, + const char *fmt, va_list *args) { #ifdef CONFIG_SB_NOTIFICATIONS if (unlikely(s->s_watchers)) { @@ -3518,8 +3521,12 @@ static inline int notify_sb_error(struct super_block *s, int error, u64 inode, .error_cookie = 0, .inode = inode, .block = block, + .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 937363d9f7b3..5fa5286c5cc7 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 @@ -130,6 +131,8 @@ struct superblock_error_notification { __u32 error_cookie; __u64 inode; __u64 block; + char function[SB_NOTIFICATION_FNAME_LEN]; + __u16 line; char desc[0]; }; -- 2.29.2