From: Jan Kara <jack@suse.cz>
To: "Luis Henriques (SUSE)" <luis.henriques@linux.dev>
Cc: Theodore Ts'o <tytso@mit.edu>, Andreas Dilger <adilger@dilger.ca>,
Jan Kara <jack@suse.cz>,
Harshad Shirwadkar <harshadshirwadkar@gmail.com>,
linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] ext4: mark fc as ineligible using an handle in ext4_xattr_set()
Date: Mon, 23 Sep 2024 13:24:38 +0200 [thread overview]
Message-ID: <20240923112438.gjn33ztjtimly4eu@quack3> (raw)
In-Reply-To: <20240923104909.18342-3-luis.henriques@linux.dev>
On Mon 23-09-24 11:49:09, Luis Henriques (SUSE) wrote:
> Calling ext4_fc_mark_ineligible() with a NULL handle is racy and may result
> in a fast-commit being done before the filesystem is effectively marked as
> ineligible. This patch moves the call to this function so that an handle
> can be used. If a transaction fails to start, then there's not point in
> trying to mark the filesystem as ineligible, and an error will eventually be
> returned to user-space.
>
> Suggested-by: Jan Kara <jack@suse.cz>
> Signed-off-by: Luis Henriques (SUSE) <luis.henriques@linux.dev>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/ext4/xattr.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
> index 46ce2f21fef9..aea9e3c405f1 100644
> --- a/fs/ext4/xattr.c
> +++ b/fs/ext4/xattr.c
> @@ -2559,6 +2559,8 @@ ext4_xattr_set(struct inode *inode, int name_index, const char *name,
>
> error = ext4_xattr_set_handle(handle, inode, name_index, name,
> value, value_len, flags);
> + ext4_fc_mark_ineligible(inode->i_sb, EXT4_FC_REASON_XATTR,
> + handle);
> error2 = ext4_journal_stop(handle);
> if (error == -ENOSPC &&
> ext4_should_retry_alloc(sb, &retries))
> @@ -2566,7 +2568,6 @@ ext4_xattr_set(struct inode *inode, int name_index, const char *name,
> if (error == 0)
> error = error2;
> }
> - ext4_fc_mark_ineligible(inode->i_sb, EXT4_FC_REASON_XATTR, NULL);
>
> return error;
> }
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2024-09-23 11:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-23 10:49 [PATCH v2 0/2] ext4: mark FC as ineligible using an handle Luis Henriques (SUSE)
2024-09-23 10:49 ` [PATCH v2 1/2] ext4: use handle to mark fc as ineligible in __track_dentry_update() Luis Henriques (SUSE)
2024-09-23 11:23 ` Jan Kara
2024-09-23 10:49 ` [PATCH v2 2/2] ext4: mark fc as ineligible using an handle in ext4_xattr_set() Luis Henriques (SUSE)
2024-09-23 11:24 ` Jan Kara [this message]
2024-10-05 2:40 ` [PATCH v2 0/2] ext4: mark FC as ineligible using an handle Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240923112438.gjn33ztjtimly4eu@quack3 \
--to=jack@suse.cz \
--cc=adilger@dilger.ca \
--cc=harshadshirwadkar@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luis.henriques@linux.dev \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox