[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <8A4E4147-0D89-4B2B-A118-F5EDABF9ABD5@dilger.ca>
Date: Tue, 27 Jul 2021 01:49:39 -0600
From: Andreas Dilger <adilger@...ger.ca>
To: Mike Fleetwood <mike.fleetwood@...glemail.com>
Cc: Reindl Harald <h.reindl@...lounge.net>, linux-ext4@...r.kernel.org,
"Darrick J. Wong" <djwong@...nel.org>
Subject: Re: Is labelling a mounted ext2/3/4 file system safe and supported?
On Jul 27, 2021, at 01:33, Mike Fleetwood <mike.fleetwood@...glemail.com> wrote:
>
> On Mon, 26 Jul 2021 at 21:50, Reindl Harald <h.reindl@...lounge.net> wrote:
>>> Am 26.07.21 um 20:45 schrieb Mike Fleetwood:
>>> Hi,
>>>
>>> Using e2label to set a new label for a mounted ext4 seems to work, but
>>> is it a safe and supported thing to do?
>>
>> it is
>
> Is there some documentation which states it's safe to write to the label
> while mounted?
>
> I ask because 1) I am looking at adding such support into GParted and
> 2) I don't understand how it can be safe.
>
> Looking at the e2label source code, it just reads the superblock,
> updates the label and writes the super block. How is that safe and
> persistent when presumably the linux kernel has an in-memory copy of the
> superblock will be written at unmount and presumable sync.
Currently, the in-memory superblock references the device buffer cache,
which is the same cache that is accessed when reading the block
device from userspace, so they are always consistent.
There has been some discussion about adding ioctl() calls to update
the filesystem label, UUID, and other fields from userspace in a safer way,
but nothing has been implemented in that direction yet (possibly Darrick
had some RFC patches, but they are not landed yet).
Cheers, Andreas
Powered by blists - more mailing lists