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 Fri 02-02-24 12:45:49, Christian Brauner wrote:
> On Thu, Feb 01, 2024 at 06:36:31PM +0100, Jan Kara wrote:
> > On Thu 01-02-24 17:16:02, Christian Brauner wrote:
> > > On Thu, Feb 01, 2024 at 12:08:58PM +0100, Jan Kara wrote:
> > > > On Tue 23-01-24 14:26:48, 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.
> > > > > 
> > > > > Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx>
> > > > 
> > > > I don't think we need def_blk_fops_restricted. If we have BLK_OPEN_WRITE
> > > > file against a bdev with bdev_writes_blocked() == true, we are sure this is
> > > > the handle blocking other writes so we can unblock them in
> > > > bdev_yield_write_access()...
> > 
> > ...
> > 
> > > -       if (mode & BLK_OPEN_RESTRICT_WRITES)
> > > +       if (mode & BLK_OPEN_WRITE) {
> > > +               if (bdev_writes_blocked(bdev))
> > > +                       bdev_unblock_writes(bdev);
> > > +               else
> > > +                       bdev->bd_writers--;
> > > +       }
> > > +       if (bdev_file->f_op == &def_blk_fops_restricted)
> > 
> > Uh, why are you leaving def_blk_fops_restricted check here? I'd expect you
> > can delete def_blk_fops_restricted completely...
> 
> Copy-paste error when dumping this into here. Here's the full patch.

Yes, the full patch looks good to me! Thanks!

								Honza
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR




[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