1. 05 11月, 2020 2 次提交
    • B
      iomap: support partial page discard on writeback block mapping failure · 763e4cdc
      Brian Foster 提交于
      iomap writeback mapping failure only calls into ->discard_page() if
      the current page has not been added to the ioend. Accordingly, the
      XFS callback assumes a full page discard and invalidation. This is
      problematic for sub-page block size filesystems where some portion
      of a page might have been mapped successfully before a failure to
      map a delalloc block occurs. ->discard_page() is not called in that
      error scenario and the bio is explicitly failed by iomap via the
      error return from ->prepare_ioend(). As a result, the filesystem
      leaks delalloc blocks and corrupts the filesystem block counters.
      
      Since XFS is the only user of ->discard_page(), tweak the semantics
      to invoke the callback unconditionally on mapping errors and provide
      the file offset that failed to map. Update xfs_discard_page() to
      discard the corresponding portion of the file and pass the range
      along to iomap_invalidatepage(). The latter already properly handles
      both full and sub-page scenarios by not changing any iomap or page
      state on sub-page invalidations.
      Signed-off-by: NBrian Foster <bfoster@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      763e4cdc
    • B
      xfs: flush new eof page on truncate to avoid post-eof corruption · 869ae85d
      Brian Foster 提交于
      It is possible to expose non-zeroed post-EOF data in XFS if the new
      EOF page is dirty, backed by an unwritten block and the truncate
      happens to race with writeback. iomap_truncate_page() will not zero
      the post-EOF portion of the page if the underlying block is
      unwritten. The subsequent call to truncate_setsize() will, but
      doesn't dirty the page. Therefore, if writeback happens to complete
      after iomap_truncate_page() (so it still sees the unwritten block)
      but before truncate_setsize(), the cached page becomes inconsistent
      with the on-disk block. A mapped read after the associated page is
      reclaimed or invalidated exposes non-zero post-EOF data.
      
      For example, consider the following sequence when run on a kernel
      modified to explicitly flush the new EOF page within the race
      window:
      
      $ xfs_io -fc "falloc 0 4k" -c fsync /mnt/file
      $ xfs_io -c "pwrite 0 4k" -c "truncate 1k" /mnt/file
        ...
      $ xfs_io -c "mmap 0 4k" -c "mread -v 1k 8" /mnt/file
      00000400:  00 00 00 00 00 00 00 00  ........
      $ umount /mnt/; mount <dev> /mnt/
      $ xfs_io -c "mmap 0 4k" -c "mread -v 1k 8" /mnt/file
      00000400:  cd cd cd cd cd cd cd cd  ........
      
      Update xfs_setattr_size() to explicitly flush the new EOF page prior
      to the page truncate to ensure iomap has the latest state of the
      underlying block.
      
      Fixes: 68a9f5e7 ("xfs: implement iomap based buffered write path")
      Signed-off-by: NBrian Foster <bfoster@redhat.com>
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      869ae85d
  2. 29 10月, 2020 1 次提交
  3. 26 10月, 2020 1 次提交
  4. 24 10月, 2020 4 次提交
    • S
      cifs: update internal module version number · aef0388a
      Steve French 提交于
      To 2.29
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      aef0388a
    • S
      smb3: add some missing definitions from MS-FSCC · 7d03ae4d
      Steve French 提交于
      Add some structures and defines that were recently added to
      the protocol documentation (see MS-FSCC sections 2.3.29-2.3.34).
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      7d03ae4d
    • S
      smb3: remove two unused variables · 6a87266c
      Steve French 提交于
      Fix two unused variables in commit
      "add support for stat of WSL reparse points for special file types"
      Reported-by: Nkernel test robot <lkp@intel.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      6a87266c
    • S
      smb3: add support for stat of WSL reparse points for special file types · 2e4564b3
      Steve French 提交于
      This is needed so when mounting to Windows we do not
      misinterpret various special files created by Linux (WSL) as symlinks.
      An earlier patch addressed readdir.  This patch fixes stat (getattr).
      
      With this patch:
        File: /mnt1/char
        Size: 0          Blocks: 0          IO Block: 16384  character special file
      Device: 34h/52d Inode: 844424930132069  Links: 1     Device type: 0,0
      Access: (0755/crwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
      Access: 2020-10-21 17:46:51.839458900 -0500
      Modify: 2020-10-21 17:46:51.839458900 -0500
      Change: 2020-10-21 18:30:39.797358800 -0500
       Birth: -
        File: /mnt1/fifo
        Size: 0          Blocks: 0          IO Block: 16384  fifo
      Device: 34h/52d Inode: 1125899906842722  Links: 1
      Access: (0755/prwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
      Access: 2020-10-21 16:21:37.259249700 -0500
      Modify: 2020-10-21 16:21:37.259249700 -0500
      Change: 2020-10-21 18:30:39.797358800 -0500
       Birth: -
        File: /mnt1/block
        Size: 0          Blocks: 0          IO Block: 16384  block special file
      Device: 34h/52d Inode: 844424930132068  Links: 1     Device type: 0,0
      Access: (0755/brwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
      Access: 2020-10-21 17:10:47.913103200 -0500
      Modify: 2020-10-21 17:10:47.913103200 -0500
      Change: 2020-10-21 18:30:39.796725500 -0500
       Birth: -
      
      without the patch all show up incorrectly as symlinks with annoying "operation not supported error also returned"
        File: /mnt1/charstat: cannot read symbolic link '/mnt1/char': Operation not supported
      
        Size: 0          Blocks: 0          IO Block: 16384  symbolic link
      Device: 34h/52d Inode: 844424930132069  Links: 1
      Access: (0000/l---------)  Uid: (    0/    root)   Gid: (    0/    root)
      Access: 2020-10-21 17:46:51.839458900 -0500
      Modify: 2020-10-21 17:46:51.839458900 -0500
      Change: 2020-10-21 18:30:39.797358800 -0500
       Birth: -
        File: /mnt1/fifostat: cannot read symbolic link '/mnt1/fifo': Operation not supported
      
        Size: 0          Blocks: 0          IO Block: 16384  symbolic link
      Device: 34h/52d Inode: 1125899906842722  Links: 1
      Access: (0000/l---------)  Uid: (    0/    root)   Gid: (    0/    root)
      Access: 2020-10-21 16:21:37.259249700 -0500
      Modify: 2020-10-21 16:21:37.259249700 -0500
      Change: 2020-10-21 18:30:39.797358800 -0500
       Birth: -
        File: /mnt1/blockstat: cannot read symbolic link '/mnt1/block': Operation not supported
      
        Size: 0          Blocks: 0          IO Block: 16384  symbolic link
      Device: 34h/52d Inode: 844424930132068  Links: 1
      Access: (0000/l---------)  Uid: (    0/    root)   Gid: (    0/    root)
      Access: 2020-10-21 17:10:47.913103200 -0500
      Modify: 2020-10-21 17:10:47.913103200 -0500
      Change: 2020-10-21 18:30:39.796725500 -0500
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Reviewed-by: NRonnie Sahlberg <lsahlber@redhat.com>
      2e4564b3
  5. 23 10月, 2020 11 次提交
  6. 22 10月, 2020 21 次提交