1. 16 6月, 2020 3 次提交
  2. 15 6月, 2020 6 次提交
    • D
      afs: Fix the mapping of the UAEOVERFLOW abort code · 4ec89596
      David Howells 提交于
      Abort code UAEOVERFLOW is returned when we try and set a time that's out of
      range, but it's currently mapped to EREMOTEIO by the default case.
      
      Fix UAEOVERFLOW to map instead to EOVERFLOW.
      
      Found with the generic/258 xfstest.  Note that the test is wrong as it
      assumes that the filesystem will support a pre-UNIX-epoch date.
      
      Fixes: 1eda8bab ("afs: Add support for the UAE error table")
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      4ec89596
    • D
      afs: Fix truncation issues and mmap writeback size · 793fe82e
      David Howells 提交于
      Fix the following issues:
      
       (1) Fix writeback to reduce the size of a store operation to i_size,
           effectively discarding the extra data.
      
           The problem comes when afs_page_mkwrite() records that a page is about
           to be modified by mmap().  It doesn't know what bits of the page are
           going to be modified, so it records the whole page as being dirty
           (this is stored in page->private as start and end offsets).
      
           Without this, the marshalling for the store to the server extends the
           size of the file to the end of the page (in afs_fs_store_data() and
           yfs_fs_store_data()).
      
       (2) Fix setattr to actually truncate the pagecache, thereby clearing
           the discarded part of a file.
      
       (3) Fix setattr to check that the new size is okay and to disable
           ATTR_SIZE if i_size wouldn't change.
      
       (4) Force i_size to be updated as the result of a truncate.
      
       (5) Don't truncate if ATTR_SIZE is not set.
      
       (6) Call pagecache_isize_extended() if the file was enlarged.
      
      Note that truncate_set_size() isn't used because the setting of i_size is
      done inside afs_vnode_commit_status() under the vnode->cb_lock.
      
      Found with the generic/029 and generic/393 xfstests.
      
      Fixes: 31143d5d ("AFS: implement basic file write support")
      Fixes: 4343d008 ("afs: Get rid of the afs_writeback record")
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      793fe82e
    • D
      afs: Concoct ctimes · da8d0755
      David Howells 提交于
      The in-kernel afs filesystem ignores ctime because the AFS fileserver
      protocol doesn't support ctimes.  This, however, causes various xfstests to
      fail.
      
      Work around this by:
      
       (1) Setting ctime to attr->ia_ctime in afs_setattr().
      
       (2) Not ignoring ATTR_MTIME_SET, ATTR_TIMES_SET and ATTR_TOUCH settings.
      
       (3) Setting the ctime from the server mtime when on the target file when
           creating a hard link to it.
      
       (4) Setting the ctime on directories from their revised mtimes when
           renaming/moving a file.
      
      Found by the generic/221 and generic/309 xfstests.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      da8d0755
    • D
      afs: Fix EOF corruption · 3f4aa981
      David Howells 提交于
      When doing a partial writeback, afs_write_back_from_locked_page() may
      generate an FS.StoreData RPC request that writes out part of a file when a
      file has been constructed from pieces by doing seek, write, seek, write,
      ... as is done by ld.
      
      The FS.StoreData RPC is given the current i_size as the file length, but
      the server basically ignores it unless the data length is 0 (in which case
      it's just a truncate operation).  The revised file length returned in the
      result of the RPC may then not reflect what we suggested - and this leads
      to i_size getting moved backwards - which causes issues later.
      
      Fix the client to take account of this by ignoring the returned file size
      unless the data version number jumped unexpectedly - in which case we're
      going to have to clear the pagecache and reload anyway.
      
      This can be observed when doing a kernel build on an AFS mount.  The
      following pair of commands produce the issue:
      
        ld -m elf_x86_64 -z max-page-size=0x200000 --emit-relocs \
            -T arch/x86/realmode/rm/realmode.lds \
            arch/x86/realmode/rm/header.o \
            arch/x86/realmode/rm/trampoline_64.o \
            arch/x86/realmode/rm/stack.o \
            arch/x86/realmode/rm/reboot.o \
            -o arch/x86/realmode/rm/realmode.elf
        arch/x86/tools/relocs --realmode \
            arch/x86/realmode/rm/realmode.elf \
            >arch/x86/realmode/rm/realmode.relocs
      
      This results in the latter giving:
      
      	Cannot read ELF section headers 0/18: Success
      
      as the realmode.elf file got corrupted.
      
      The sequence of events can also be driven with:
      
      	xfs_io -t -f \
      		-c "pwrite -S 0x58 0 0x58" \
      		-c "pwrite -S 0x59 10000 1000" \
      		-c "close" \
      		/afs/example.com/scratch/a
      
      Fixes: 31143d5d ("AFS: implement basic file write support")
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      3f4aa981
    • D
      afs: afs_write_end() should change i_size under the right lock · 1f32ef79
      David Howells 提交于
      Fix afs_write_end() to change i_size under vnode->cb_lock rather than
      ->wb_lock so that it doesn't race with afs_vnode_commit_status() and
      afs_getattr().
      
      The ->wb_lock is only meant to guard access to ->wb_keys which isn't
      accessed by that piece of code.
      
      Fixes: 4343d008 ("afs: Get rid of the afs_writeback record")
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      1f32ef79
    • D
      afs: Fix non-setting of mtime when writing into mmap · bb413489
      David Howells 提交于
      The mtime on an inode needs to be updated when a write is made into an
      mmap'ed section.  There are three ways in which this could be done: update
      it when page_mkwrite is called, update it when a page is changed from dirty
      to writeback or leave it to the server and fix the mtime up from the reply
      to the StoreData RPC.
      
      Found with the generic/215 xfstest.
      
      Fixes: 1cf7a151 ("afs: Implement shared-writeable mmap")
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      bb413489
  3. 14 6月, 2020 2 次提交
    • D
      Revert "btrfs: switch to iomap_dio_rw() for dio" · 55e20bd1
      David Sterba 提交于
      This reverts commit a43a67a2.
      
      This patch reverts the main part of switching direct io implementation
      to iomap infrastructure. There's a problem in invalidate page that
      couldn't be solved as regression in this development cycle.
      
      The problem occurs when buffered and direct io are mixed, and the ranges
      overlap. Although this is not recommended, filesystems implement
      measures or fallbacks to make it somehow work. In this case, fallback to
      buffered IO would be an option for btrfs (this already happens when
      direct io is done on compressed data), but the change would be needed in
      the iomap code, bringing new semantics to other filesystems.
      
      Another problem arises when again the buffered and direct ios are mixed,
      invalidation fails, then -EIO is set on the mapping and fsync will fail,
      though there's no real error.
      
      There have been discussions how to fix that, but revert seems to be the
      least intrusive option.
      
      Link: https://lore.kernel.org/linux-btrfs/20200528192103.xm45qoxqmkw7i5yl@fiona/Signed-off-by: NDavid Sterba <dsterba@suse.com>
      55e20bd1
    • M
      treewide: replace '---help---' in Kconfig files with 'help' · a7f7f624
      Masahiro Yamada 提交于
      Since commit 84af7a61 ("checkpatch: kconfig: prefer 'help' over
      '---help---'"), the number of '---help---' has been gradually
      decreasing, but there are still more than 2400 instances.
      
      This commit finishes the conversion. While I touched the lines,
      I also fixed the indentation.
      
      There are a variety of indentation styles found.
      
        a) 4 spaces + '---help---'
        b) 7 spaces + '---help---'
        c) 8 spaces + '---help---'
        d) 1 space + 1 tab + '---help---'
        e) 1 tab + '---help---'    (correct indentation)
        f) 1 tab + 1 space + '---help---'
        g) 1 tab + 2 spaces + '---help---'
      
      In order to convert all of them to 1 tab + 'help', I ran the
      following commend:
      
        $ find . -name 'Kconfig*' | xargs sed -i 's/^[[:space:]]*---help---/\thelp/'
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      a7f7f624
  4. 13 6月, 2020 4 次提交
    • S
      smb3: Add debug message for new file creation with idsfromsid mount option · a7a519a4
      Steve French 提交于
      Pavel noticed that a debug message (disabled by default) in creating the security
      descriptor context could be useful for new file creation owner fields
      (as we already have for the mode) when using mount parm idsfromsid.
      
      [38120.392272] CIFS: FYI: owner S-1-5-88-1-0, group S-1-5-88-2-0
      [38125.792637] CIFS: FYI: owner S-1-5-88-1-1000, group S-1-5-88-2-1000
      
      Also cleans up a typo in a comment
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      a7a519a4
    • E
      proc: Use new_inode not new_inode_pseudo · ef1548ad
      Eric W. Biederman 提交于
      Recently syzbot reported that unmounting proc when there is an ongoing
      inotify watch on the root directory of proc could result in a use
      after free when the watch is removed after the unmount of proc
      when the watcher exits.
      
      Commit 69879c01 ("proc: Remove the now unnecessary internal mount
      of proc") made it easier to unmount proc and allowed syzbot to see the
      problem, but looking at the code it has been around for a long time.
      
      Looking at the code the fsnotify watch should have been removed by
      fsnotify_sb_delete in generic_shutdown_super.  Unfortunately the inode
      was allocated with new_inode_pseudo instead of new_inode so the inode
      was not on the sb->s_inodes list.  Which prevented
      fsnotify_unmount_inodes from finding the inode and removing the watch
      as well as made it so the "VFS: Busy inodes after unmount" warning
      could not find the inodes to warn about them.
      
      Make all of the inodes in proc visible to generic_shutdown_super,
      and fsnotify_sb_delete by using new_inode instead of new_inode_pseudo.
      The only functional difference is that new_inode places the inodes
      on the sb->s_inodes list.
      
      I wrote a small test program and I can verify that without changes it
      can trigger this issue, and by replacing new_inode_pseudo with
      new_inode the issues goes away.
      
      Cc: stable@vger.kernel.org
      Link: https://lkml.kernel.org/r/000000000000d788c905a7dfa3f4@google.com
      Reported-by: syzbot+7d2debdcdb3cb93c1e5e@syzkaller.appspotmail.com
      Fixes: 0097875b ("proc: Implement /proc/thread-self to point at the directory of the current thread")
      Fixes: 021ada7d ("procfs: switch /proc/self away from proc_dir_entry")
      Fixes: 51f0885e ("vfs,proc: guarantee unique inodes in /proc")
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      ef1548ad
    • S
      cifs: fix chown and chgrp when idsfromsid mount option enabled · a6603398
      Steve French 提交于
      idsfromsid was ignored in chown and chgrp causing it to fail
      when upcalls were not configured for lookup.  idsfromsid allows
      mapping users when setting user or group ownership using
      "special SID" (reserved for this).  Add support for chmod and chgrp
      when idsfromsid mount option is enabled.
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      a6603398
    • S
      smb3: allow uid and gid owners to be set on create with idsfromsid mount option · 975221ec
      Steve French 提交于
      Currently idsfromsid mount option allows querying owner information from the
      special sids used to represent POSIX uids and gids but needed changes to
      populate the security descriptor context with the owner information when
      idsfromsid mount option was used.
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      975221ec
  5. 12 6月, 2020 14 次提交
  6. 11 6月, 2020 11 次提交