Re: [PATCH v2 31/34] block: use file->f_op to indicate restricted writes

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

 



On Tue, Jan 23, 2024 at 02:26:48PM +0100, Christian Brauner wrote:
> Make it possible to detected a block device that was opened with
> restricted write access solely based on its file operations that it was
> opened with. This avoids wasting an FMODE_* flag.
> 
> def_blk_fops isn't needed to check whether something is a block device
> checking the inode type is enough for that. And def_blk_fops_restricted
> can be kept private to the block layer.

I agree with not wasting a FMODE_* flag, but I also really hate
duplicating the file operations.

I went to search for a good place to stash this information and ended up
at the f_version field in struct file.  That one is never touched by the 
VFS proper but just the file system and a few lseek helpers.  The
latter currently happen to be used by block devices unfortunately,
but it seem like moving the f_version clearing into the few filesystem
actualy using it would be good code hygiene anyway.





[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