mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ethan Ferguson <ethan.ferguson@zetier.com>
To: hch@infradead.org
Cc: ethan.ferguson@zetier.com, linkinjeon@kernel.org,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	sj1557.seo@samsung.com, yuezhang.mo@sony.com
Subject: [PATCH v2 0/1] exfat: Add support for FS_IOC_{GET,SET}FSLABEL
Date: Mon, 18 Aug 2025 13:49:11 -0400	[thread overview]
Message-ID: <20250818174911.365889-1-ethan.ferguson@zetier.com> (raw)
In-Reply-To: <aKK_qq9ySdYDjhAD@infradead.org>

On 8/18/25 01:52, Christoph Hellwig wrote:
> On Sun, Aug 17, 2025 at 10:32:00AM -0400, Ethan Ferguson wrote:
>> Both e2fsprogs and btrfs-progs now use the FS_IOC_{GET,SET}FSLABEL
>> ioctls to change the label on a mounted filesystem.
> 
> Additionally userspace writes to blocks on mounted file systems are
> dangerous.  They can easily corrupt data when racing with updates
> performed by the kernel, and are impossible when the the
> CONFIG_BLK_DEV_WRITE_MOUNTED config option is disabled.

That's fair. I took a look at how btrfs guards against this, it seems
as if they use mnt_want_write_file to guard against bad writes, and
only write to the in-memory superblock, and commit the transaction
afterwards. However, this (during my testing with
CONFIG_BLK_DEV_WRITE_MOUNTED both on and off) still results in an
immediate disk flush.

My changes from this thread also seem to work with
CONFIG_BLK_DEV_WRITE_MOUNTED both disabled and enabled.

Maybe an alternative would be to only write to sbi->volume_label (with
mutex guarding), and only flush to disk on exfat_put_super? And to use
mnt_want_write_file as well.

Unfortunately, given that I'm pretty new to kernel development, I
wouldn't know that the best way to approach this. Any thoughts, or
pointers in the right direction, would be appreciated.

Thank you for the feedback!

  reply	other threads:[~2025-08-18 17:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-17  0:30 Ethan Ferguson
2025-08-17  0:30 ` [PATCH v2 1/1] " Ethan Ferguson
2025-08-19  1:45   ` Namjae Jeon
2025-08-19 13:22     ` [PATCH] " Ethan Ferguson
2025-08-19 14:51       ` Namjae Jeon
2025-08-19  5:32   ` [PATCH v2 1/1] " Yuezhang.Mo
2025-08-17 12:30 ` [PATCH v2 0/1] " Namjae Jeon
2025-08-17 14:32   ` [PATCH v2 1/1] " Ethan Ferguson
2025-08-18  5:52     ` Christoph Hellwig
2025-08-18 17:49       ` Ethan Ferguson [this message]
2025-08-19  8:15         ` [PATCH v2 0/1] " Christoph Hellwig

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=20250818174911.365889-1-ethan.ferguson@zetier.com \
    --to=ethan.ferguson@zetier.com \
    --cc=hch@infradead.org \
    --cc=linkinjeon@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sj1557.seo@samsung.com \
    --cc=yuezhang.mo@sony.com \
    /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®