lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKYAXd_CPA-mmyT9_0y+E4D+O92q6q9hipGac6c8QoGktCCAvg@mail.gmail.com>
Date: Tue, 3 Feb 2026 22:08:06 +0900
From: Namjae Jeon <linkinjeon@...nel.org>
To: Christoph Hellwig <hch@....de>
Cc: viro@...iv.linux.org.uk, brauner@...nel.org, tytso@....edu, 
	willy@...radead.org, jack@...e.cz, djwong@...nel.org, josef@...icpanda.com, 
	sandeen@...deen.net, rgoldwyn@...e.com, xiang@...nel.org, dsterba@...e.com, 
	pali@...nel.org, ebiggers@...nel.org, neil@...wn.name, amir73il@...il.com, 
	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org, 
	iamjoonsoo.kim@....com, cheol.lee@....com, jay.sim@....com, gunho.lee@....com, 
	Hyunchul Lee <hyc.lee@...il.com>
Subject: Re: [PATCH v6 08/16] ntfs: update file operations

On Tue, Feb 3, 2026 at 3:07 PM Christoph Hellwig <hch@....de> wrote:
>
> Suggested commit message:
>
> Rewrite the file operations to utilize the iomap infrastructure,
> replacing the legacy buffer-head based implementation.
>
> Implement ntfs_setattr() with size change handling, uid/gid/mode.
>
> Add support for Direct I/O.
>
> Add support for fallocate with the FALLOC_FL_KEEP_SIZE,
> FALLOC_FL_PUNCH_HOLE, FALLOC_FL_COLLAPSE_RANGE, FALLOC_FL_INSERT_RANGE
> and FALLOC_FL_ALLOCATE_RANGE modes.
>
> Implement .llseek with SEEK_DATA / SEEK_HOLE support.
>
> Implement ntfs_fiemap() using iomap_fiemap().
>
> Add FS_IOC_SHUTDOWN, FS_IOC_[GS]ETFSLABEL, FITRIM ioctl support.
I will use it in the next version.
>
> >  static int ntfs_file_open(struct inode *vi, struct file *filp)
> >  {
> > +     struct ntfs_inode *ni = NTFS_I(vi);
> > +
> > +     if (NVolShutdown(ni->vol))
> > +             return -EIO;
> > +
> >       if (sizeof(unsigned long) < 8) {
> >               if (i_size_read(vi) > MAX_LFS_FILESIZE)
> >                       return -EOVERFLOW;
> >       }
> > +     if (filp->f_flags & O_TRUNC && NInoNonResident(ni)) {
> > +             int err;
> >
> > +             mutex_lock(&ni->mrec_lock);
> > +             down_read(&ni->runlist.lock);
> > +             if (!ni->runlist.rl) {
> > +                     err = ntfs_attr_map_whole_runlist(ni);
> > +                     if (err) {
> > +                             up_read(&ni->runlist.lock);
> > +                             mutex_unlock(&ni->mrec_lock);
> > +                             return err;
> > +                     }
> >               }
> > +             ni->lcn_seek_trunc = ni->runlist.rl->lcn;
> > +             up_read(&ni->runlist.lock);
> > +             mutex_unlock(&ni->mrec_lock);
> >       }
>
> Do you ever hits this?  O_TRUNC should call into ->setattr to do
> the truncation long before calling into ->open.
Right, I will remove it.
>
> > +
> > +     filp->f_mode |= FMODE_NOWAIT;
>
> This should also set FMODE_CAN_ODIRECT instead of setting the noop
> direct I/O method.
Okay.
>
> > +static int ntfs_file_release(struct inode *vi, struct file *filp)
> >  {
> > +     struct ntfs_inode *ni = NTFS_I(vi);
> > +     struct ntfs_volume *vol = ni->vol;
> > +     s64 aligned_data_size = round_up(ni->data_size, vol->cluster_size);
> > +
> > +     if (NInoCompressed(ni))
> > +             return 0;
> > +
> > +     inode_lock(vi);
> > +     mutex_lock(&ni->mrec_lock);
> > +     down_write(&ni->runlist.lock);
> > +     if (aligned_data_size < ni->allocated_size) {
>
> Splitting the compresse handling into a helper would really help
> the code maintainability here.  Also please add a comment why
> this does work on final release, which is highly unusual.  And
> even more unusual then doing it in ->flush which is called for
> every close.
Okay, I will add a helper and add a comment for this.
>
> Otherwise looks good:
>
> Reviewed-by: Christoph Hellwig <hch@....de>
Thanks for the review!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ