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 Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux