Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2812392pxu; Mon, 7 Dec 2020 16:58:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJx0gcoEpvYjtmLnq7PLgAtVBelar2TgDbvBtuHH5ZG+XYpNZ87hcQbQSsi4ESt2aINKlF85 X-Received: by 2002:a50:f9cc:: with SMTP id a12mr8107879edq.335.1607389100130; Mon, 07 Dec 2020 16:58:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607389100; cv=none; d=google.com; s=arc-20160816; b=aghz9R5oqRMqHltN17/XWi2Bx4ufoDdMr9BfugL0PL87C8eX8HUOv5burTEIVwPEfM XoA6nph0yxMGI2g5pE0jo8OLy4Y/rZrCeC7/Yg7K3drHhqH0KjoKfUXpQkO1hh+VsA9g +RoQnd4E/zzHospjGtMigmtEekrKWM2QHlIFKM3Y+gF2no5470MMNXNAUkhWUY8txN6+ KvJ04q42xZx+d9HFOhLgIJ12BmJLVIDlxT5gaXbjhMlak7saPh+RFS9QoDX+eNJ02OSk ciZq5fMC4/9e13XfRskSfpCKjRb8jiyHZhMCWsn1tM/Ft0F0QL3dVfCynJGnRw+KFber yKHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:organization:subject:cc:to:from; bh=p7OvyGCQEB/9NKu/xG5q8sZxPwTTdVYNU9ZWqOZWglE=; b=JKgvlcso9oEUvubtWGNQm22ohkasfQ8fLRaj4wDAHO3Hj5YkjB1HoD2WFBJ184QzTX vfPkMS+4MH2Wnp4sUZCjcCr9HFBV01Bw2g/okTxToCawb2EN1xK9S/3cVsgFaVCvv6gH rXv5qdHlLkWdm2oWek7An0xAGCqwOqG3X4R5v4p90eEV+3HmYhxlmbQw8IQd57xxmfzR W/XZODhIhNNQ9PdMPOW9lEDqAUKfMBGzHBmDK21ix0ndxCTgKGuTox5MYvrwc5vUEEeM ay3FGpMhdPEJNRAjcT34KPzOiqNURxr1FgSyA/dl88cV4oVGhl7jkkrnBkZ3ObjgmE9Y /Bxw== 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 p1si7420861ejx.531.2020.12.07.16.57.57; Mon, 07 Dec 2020 16:58:20 -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 S1726207AbgLHAzz (ORCPT + 99 others); Mon, 7 Dec 2020 19:55:55 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:57046 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726055AbgLHAzz (ORCPT ); Mon, 7 Dec 2020 19:55:55 -0500 Received: from localhost (unknown [IPv6:2804:14c:132:242d::1001]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: krisman) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id DAF5D1F44924; Tue, 8 Dec 2020 00:55:12 +0000 (GMT) From: Gabriel Krisman Bertazi To: "Darrick J. Wong" Cc: dhowells@redhat.com, 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, kernel@collabora.com Subject: Re: [PATCH 5/8] vfs: Include origin of the SB error notification Organization: Collabora References: <20201208003117.342047-1-krisman@collabora.com> <20201208003117.342047-6-krisman@collabora.com> <20201208005110.GA106255@magnolia> Date: Mon, 07 Dec 2020 21:55:08 -0300 In-Reply-To: <20201208005110.GA106255@magnolia> (Darrick J. Wong's message of "Mon, 7 Dec 2020 16:51:10 -0800") Message-ID: <87zh2p5d77.fsf@collabora.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org "Darrick J. Wong" writes: > On Mon, Dec 07, 2020 at 09:31:14PM -0300, Gabriel Krisman Bertazi wrote: >> 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 df588edc0a34..864d86fcc68c 100644 >> --- a/include/linux/fs.h >> +++ b/include/linux/fs.h >> @@ -3514,14 +3514,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)) { >> @@ -3534,8 +3537,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; > > Er... this is enlarging a structure in the userspace ABI, right? Which > will break userspace that latched on to the structure definition in the > previous patch, and therefore isn't expecting a function name here. Hi Darrick, Since the structure is defined in the patch immediately before, I thought it would be ok to split the patch to preserve authorship of the different parts. I will fold this into patch 4 in the next iteration. > > If you're gonna put a character string(?) at the end then I guess you > have to pre-pad the notification structure so that we can add things > later, or.... bump the type code every time you add a field? > > (Maybe I misread that? But this is include/uapi/...) > > --D > >> char desc[0]; >> }; >> >> -- >> 2.29.2 >> -- Gabriel Krisman Bertazi