Re: [PATCH 4/7] swapon(2): open swap with O_EXCL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Apr 27, 2024 at 02:40:22PM -0700, Linus Torvalds wrote:
> On Sat, 27 Apr 2024 at 14:11, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
> >
> > ... eliminating the need to reopen block devices so they could be
> > exclusively held.
> 
> This looks like a good change, but it raises the question of why we
> did it this odd way to begin with?
> 
> Is it just because O_EXCL without O_CREAT is kind of odd, and only has
> meaning for block devices?
> 
> Or is it just that before we used fiel pointers for block devices, the
> old model made more sense?
> 
> Anyway, I like it, it just makes me go "why didn't we do it that way
> originally?"

Exclusion for swap partitions:

commit 75e9c9e1bffbe4a1767172855296b94ccba28f71
Author: Alexander Viro <viro@xxxxxxxxxxxx>
Date:   Mon Mar 4 22:56:47 2002 -0800

    [PATCH] death of is_mounted() and aother fixes


O_EXCL for block devices:

commit c366082d9ed0a0d3c46441d1b3fdf895d8e55ca9
Author: Andrew Morton <akpm@xxxxxxxx>
Date:   Wed Aug 20 10:26:57 2003 -0700

    [PATCH] Allow O_EXCL on a block device to claim exclusive use.

IOW, O_EXCL hadn't been available at the time - it had been implemented
on top of bd_claim()/bd_release() introduced in the same earlier commit.

Switching swap exclusion to O_EXCL could've been done back in 2003 or
at any later point; it's just that swapon(2)/swapoff(2) is something that
rarely gets a look...




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux