Re: [PATCH v2 29/34] bdev: make struct bdev_handle private to the block layer

Jan Kara
2024-02-01T17:42:37Z

On Thu 01-02-24 16:07:59, Christian Brauner wrote:
> > > + if (ret)
> > > + return ERR_PTR(ret);
> > > +
> > > + bdev = blkdev_get_no_open(dev);
> > > + if (!bdev)
> > > + return ERR_PTR(-ENXIO);
> > >
> > > flags = blk_to_file_flags(mode);
> > > - bdev_file = alloc_file_pseudo_noaccount(handle->bdev->bd_inode,
> > > + bdev_file = alloc_file_pseudo_noaccount(bdev->bd_inode,
> > > blockdev_mnt, "", flags | O_LARGEFILE, &def_blk_fops);
> > > if (IS_ERR(bdev_file)) {
> > > - bdev_release(handle);
> > > + blkdev_put_no_open(bdev);
> > > return bdev_file;
> > > }
> > > - ihold(handle->bdev->bd_inode);
> > > + bdev_file->f_mode &= ~FMODE_OPENED;
> >
> > Hum, why do you need these games with FMODE_OPENED? I suspect you want to
> > influence fput() behavior but then AFAICT we will leak dentry, mnt, etc. on
> > error? If this is indeed needed, it deserves a comment...
>
> I rewrote this.
>
> Total diff I applied is:

Looks good now.

Honza

--
Jan Kara <jack@suse.com>
SUSE Labs, CR