From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Christian Brauner <brauner@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 3/4] fat: support O_TMPFILE on msdos
Date: Sat, 28 Nov 2026 16:53:02 +0900 [thread overview]
Message-ID: <8733slqtnl.fsf@mail.parknet.co.jp> (raw)
In-Reply-To: <20261126-work-fat-tmpfile-v1-3-3bca7b2dbc20@kernel.org>
Christian Brauner <brauner@kernel.org> writes:
> Do what vfat does. msdos_link() creates the directory entry the same
> way msdos_create() does and handles ATTR_HIDDEN like do_msdos_rename().
> With the dots mount option a leading dot means the file is hidden and
> __fat_write_inode() writes the attributes from i_attrs. So i_attrs has
> to agree with the new name.
>
> Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
> ---
> fs/fat/namei_msdos.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 70 insertions(+)
>
> diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c
> index 5a43d042eb01f..5709650a29986 100644
> --- a/fs/fat/namei_msdos.c
> +++ b/fs/fat/namei_msdos.c
> @@ -439,6 +439,74 @@ static int msdos_unlink(struct inode *dir, struct dentry *dentry)
> return err;
> }
>
> +/***** Give an O_TMPFILE its first name */
> +static int msdos_link(struct dentry *old_dentry, struct inode *dir,
> + struct dentry *dentry)
> +{
[...]
> + err = msdos_format_name(dentry->d_name.name, dentry->d_name.len,
> + msdos_name, &MSDOS_SB(sb)->options);
> + if (err)
> + goto out;
> + is_hid = (dentry->d_name.name[0] == '.') && (msdos_name[0] != '.');
> + /* Have to do it due to foo vs. .foo conflicts */
> + if (!fat_scan(dir, msdos_name, &sinfo)) {
> + brelse(sinfo.bh);
> + err = -EINVAL;
> + goto out;
> + }
Maybe this part is better to share with others?
> + ts = current_time(dir);
> + err = msdos_add_entry(dir, msdos_name, 0, is_hid, 0, &ts, &sinfo);
> + if (err)
> + goto out;
> + inode_inc_iversion(dir);
> +
> + old_attrs = MSDOS_I(inode)->i_attrs;
> + fat_attach(inode, sinfo.i_pos);
> + if (is_hid)
> + MSDOS_I(inode)->i_attrs |= ATTR_HIDDEN;
> + else
> + MSDOS_I(inode)->i_attrs &= ~ATTR_HIDDEN;
> + mark_inode_dirty(inode);
> + if (IS_DIRSYNC(dir)) {
> + err = sync_inode_metadata(inode, 1);
Please add "FIXME: this sync should be done within msdos_add_entry()"
Thanks.
> + if (err)
> + goto out_detach;
> + }
> + brelse(sinfo.bh);
[...]
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
next prev parent reply other threads:[~2026-11-28 7:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 22:15 [PATCH 0/4] fat: support O_TMPFILE Christian Brauner
2026-11-26 22:15 ` [PATCH 1/4] fat: add fat_tmpfile() Christian Brauner
2026-11-28 7:49 ` OGAWA Hirofumi
2026-11-26 22:15 ` [PATCH 2/4] fat: support O_TMPFILE on vfat Christian Brauner
2026-11-28 7:50 ` OGAWA Hirofumi
2026-11-26 22:15 ` [PATCH 3/4] fat: support O_TMPFILE on msdos Christian Brauner
2026-11-28 7:53 ` OGAWA Hirofumi [this message]
2026-11-26 22:15 ` [PATCH 4/4] selftests/filesystems: add FAT O_TMPFILE tests Christian Brauner
2026-11-27 8:43 ` [PATCH 0/4] fat: support O_TMPFILE Alexander Mikhalitsyn
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=8733slqtnl.fsf@mail.parknet.co.jp \
--to=hirofumi@mail.parknet.co.jp \
--cc=brauner@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®