1. 27 1月, 2020 3 次提交
    • J
      io_uring: don't cancel all work on process exit · ebe10026
      Jens Axboe 提交于
      If we're sharing the ring across forks, then one process exiting means
      that we cancel ALL work and prevent future work. This is overly
      restrictive. As long as we cancel the work associated with the files
      from the current task, it's safe to let others persist. Normal fd close
      on exit will still wait (and cancel) pending work.
      
      Fixes: fcb323cc ("io_uring: io_uring: add support for async work inheriting files")
      Reported-by: NAndres Freund <andres@anarazel.de>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      ebe10026
    • J
      Revert "io_uring: only allow submit from owning task" · 73e08e71
      Jens Axboe 提交于
      This ends up being too restrictive for tasks that willingly fork and
      share the ring between forks. Andres reports that this breaks his
      postgresql work. Since we're close to 5.5 release, revert this change
      for now.
      
      Cc: stable@vger.kernel.org
      Fixes: 44d28279 ("io_uring: only allow submit from owning task")
      Reported-by: NAndres Freund <andres@anarazel.de>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      73e08e71
    • D
      afs: Fix characters allowed into cell names · a45ea48e
      David Howells 提交于
      The afs filesystem needs to prohibit certain characters from cell names,
      such as '/', as these are used to form filenames in procfs, leading to
      the following warning being generated:
      
      	WARNING: CPU: 0 PID: 3489 at fs/proc/generic.c:178
      
      Fix afs_alloc_cell() to disallow nonprintable characters, '/', '@' and
      names that begin with a dot.
      
      Remove the check for "@cell" as that is then redundant.
      
      This can be tested by running:
      
      	echo add foo/.bar 1.2.3.4 >/proc/fs/afs/cells
      
      Note that we will also need to deal with:
      
       - Names ending in ".invalid" shouldn't be passed to the DNS.
      
       - Names that contain non-valid domainname chars shouldn't be passed to
         the DNS.
      
       - DNS replies that say "your-dns-needs-immediate-attention.<gTLD>" and
         replies containing A records that say 127.0.53.53 should be
         considered invalid.
         [https://www.icann.org/en/system/files/files/name-collision-mitigation-01aug14-en.pdf]
      
      but these need to be dealt with by the kafs-client DNS program rather
      than the kernel.
      
      Reported-by: syzbot+b904ba7c947a37b4b291@syzkaller.appspotmail.com
      Cc: stable@kernel.org
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a45ea48e
  2. 26 1月, 2020 1 次提交
  3. 25 1月, 2020 1 次提交
    • D
      btrfs: dev-replace: remove warning for unknown return codes when finished · 4cea9037
      David Sterba 提交于
      The fstests btrfs/011 triggered a warning at the end of device replace,
      
        [ 1891.998975] BTRFS warning (device vdd): failed setting block group ro: -28
        [ 1892.038338] BTRFS error (device vdd): btrfs_scrub_dev(/dev/vdd, 1, /dev/vdb) failed -28
        [ 1892.059993] ------------[ cut here ]------------
        [ 1892.063032] WARNING: CPU: 2 PID: 2244 at fs/btrfs/dev-replace.c:506 btrfs_dev_replace_start.cold+0xf9/0x140 [btrfs]
        [ 1892.074346] CPU: 2 PID: 2244 Comm: btrfs Not tainted 5.5.0-rc7-default+ #942
        [ 1892.079956] RIP: 0010:btrfs_dev_replace_start.cold+0xf9/0x140 [btrfs]
      
        [ 1892.096576] RSP: 0018:ffffbb58c7b3fd10 EFLAGS: 00010286
        [ 1892.098311] RAX: 00000000ffffffe4 RBX: 0000000000000001 RCX: 8888888888888889
        [ 1892.100342] RDX: 0000000000000001 RSI: ffff9e889645f5d8 RDI: ffffffff92821080
        [ 1892.102291] RBP: ffff9e889645c000 R08: 000001b8878fe1f6 R09: 0000000000000000
        [ 1892.104239] R10: ffffbb58c7b3fd08 R11: 0000000000000000 R12: ffff9e88a0017000
        [ 1892.106434] R13: ffff9e889645f608 R14: ffff9e88794e1000 R15: ffff9e88a07b5200
        [ 1892.108642] FS:  00007fcaed3f18c0(0000) GS:ffff9e88bda00000(0000) knlGS:0000000000000000
        [ 1892.111558] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        [ 1892.113492] CR2: 00007f52509ff420 CR3: 00000000603dd002 CR4: 0000000000160ee0
      
        [ 1892.115814] Call Trace:
        [ 1892.116896]  btrfs_dev_replace_by_ioctl+0x35/0x60 [btrfs]
        [ 1892.118962]  btrfs_ioctl+0x1d62/0x2550 [btrfs]
      
      caused by the previous patch ("btrfs: scrub: Require mandatory block
      group RO for dev-replace"). Hitting ENOSPC is possible and could happen
      when the block group is set read-only, preventing NOCOW writes to the
      area that's being accessed by dev-replace.
      
      This has happend with scratch devices of size 12G but not with 5G and
      20G, so this is depends on timing and other activity on the filesystem.
      The whole replace operation is restartable, the space state should be
      examined by the user in any case.
      
      The error code is propagated back to the ioctl caller so the kernel
      warning is causing false alerts.
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      4cea9037
  4. 24 1月, 2020 3 次提交
    • Q
      btrfs: scrub: Require mandatory block group RO for dev-replace · 1bbb97b8
      Qu Wenruo 提交于
      [BUG]
      For dev-replace test cases with fsstress, like btrfs/06[45] btrfs/071,
      looped runs can lead to random failure, where scrub finds csum error.
      
      The possibility is not high, around 1/20 to 1/100, but it's causing data
      corruption.
      
      The bug is observable after commit b12de528 ("btrfs: scrub: Don't
      check free space before marking a block group RO")
      
      [CAUSE]
      Dev-replace has two source of writes:
      
      - Write duplication
        All writes to source device will also be duplicated to target device.
      
        Content:	Not yet persisted data/meta
      
      - Scrub copy
        Dev-replace reused scrub code to iterate through existing extents, and
        copy the verified data to target device.
      
        Content:	Previously persisted data and metadata
      
      The difference in contents makes the following race possible:
      	Regular Writer		|	Dev-replace
      -----------------------------------------------------------------
        ^                             |
        | Preallocate one data extent |
        | at bytenr X, len 1M		|
        v				|
        ^ Commit transaction		|
        | Now extent [X, X+1M) is in  |
        v commit root			|
       ================== Dev replace starts =========================
        				| ^
      				| | Scrub extent [X, X+1M)
      				| | Read [X, X+1M)
      				| | (The content are mostly garbage
      				| |  since it's preallocated)
        ^				| v
        | Write back happens for	|
        | extent [X, X+512K)		|
        | New data writes to both	|
        | source and target dev.	|
        v				|
      				| ^
      				| | Scrub writes back extent [X, X+1M)
      				| | to target device.
      				| | This will over write the new data in
      				| | [X, X+512K)
      				| v
      
      This race can only happen for nocow writes. Thus metadata and data cow
      writes are safe, as COW will never overwrite extents of previous
      transaction (in commit root).
      
      This behavior can be confirmed by disabling all fallocate related calls
      in fsstress (*), then all related tests can pass a 2000 run loop.
      
      *: FSSTRESS_AVOID="-f fallocate=0 -f allocsp=0 -f zero=0 -f insert=0 \
      		   -f collapse=0 -f punch=0 -f resvsp=0"
         I didn't expect resvsp ioctl will fallback to fallocate in VFS...
      
      [FIX]
      Make dev-replace to require mandatory block group RO, and wait for current
      nocow writes before calling scrub_chunk().
      
      This patch will mostly revert commit 76a8efa1 ("btrfs: Continue replace
      when set_block_ro failed") for dev-replace path.
      
      The side effect is, dev-replace can be more strict on avaialble space, but
      definitely worth to avoid data corruption.
      Reported-by: NFilipe Manana <fdmanana@suse.com>
      Fixes: 76a8efa1 ("btrfs: Continue replace when set_block_ro failed")
      Fixes: b12de528 ("btrfs: scrub: Don't check free space before marking a block group RO")
      Reviewed-by: NFilipe Manana <fdmanana@suse.com>
      Signed-off-by: NQu Wenruo <wqu@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      1bbb97b8
    • L
      readdir: make user_access_begin() use the real access range · 3c2659bd
      Linus Torvalds 提交于
      In commit 9f79b78e ("Convert filldir[64]() from __put_user() to
      unsafe_put_user()") I changed filldir to not do individual __put_user()
      accesses, but instead use unsafe_put_user() surrounded by the proper
      user_access_begin/end() pair.
      
      That make them enormously faster on modern x86, where the STAC/CLAC
      games make individual user accesses fairly heavy-weight.
      
      However, the user_access_begin() range was not really the exact right
      one, since filldir() has the unfortunate problem that it needs to not
      only fill out the new directory entry, it also needs to fix up the
      previous one to contain the proper file offset.
      
      It's unfortunate, but the "d_off" field in "struct dirent" is _not_ the
      file offset of the directory entry itself - it's the offset of the next
      one.  So we end up backfilling the offset in the previous entry as we
      walk along.
      
      But since x86 didn't really care about the exact range, and used to be
      the only architecture that did anything fancy in user_access_begin() to
      begin with, the filldir[64]() changes did something lazy, and even
      commented on it:
      
      	/*
      	 * Note! This range-checks 'previous' (which may be NULL).
      	 * The real range was checked in getdents
      	 */
      	if (!user_access_begin(dirent, sizeof(*dirent)))
      		goto efault;
      
      and it all worked fine.
      
      But now 32-bit ppc is starting to also implement user_access_begin(),
      and the fact that we faked the range to only be the (possibly not even
      valid) previous directory entry becomes a problem, because ppc32 will
      actually be using the range that is passed in for more than just "check
      that it's user space".
      
      This is a complete rewrite of Christophe's original patch.
      
      By saving off the record length of the previous entry instead of a
      pointer to it in the filldir data structures, we can simplify the range
      check and the writing of the previous entry d_off field.  No need for
      any conditionals in the user accesses themselves, although we retain the
      conditional EINTR checking for the "was this the first directory entry"
      signal handling latency logic.
      
      Fixes: 9f79b78e ("Convert filldir[64]() from __put_user() to unsafe_put_user()")
      Link: https://lore.kernel.org/lkml/a02d3426f93f7eb04960a4d9140902d278cab0bb.1579697910.git.christophe.leroy@c-s.fr/
      Link: https://lore.kernel.org/lkml/408c90c4068b00ea8f1c41cca45b84ec23d4946b.1579783936.git.christophe.leroy@c-s.fr/Reported-and-tested-by: NChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3c2659bd
    • L
      readdir: be more conservative with directory entry names · 2c6b7bcd
      Linus Torvalds 提交于
      Commit 8a23eb80 ("Make filldir[64]() verify the directory entry
      filename is valid") added some minimal validity checks on the directory
      entries passed to filldir[64]().  But they really were pretty minimal.
      
      This fleshes out at least the name length check: we used to disallow
      zero-length names, but really, negative lengths or oevr-long names
      aren't ok either.  Both could happen if there is some filesystem
      corruption going on.
      
      Now, most filesystems tend to use just an "unsigned char" or similar for
      the length of a directory entry name, so even with a corrupt filesystem
      you should never see anything odd like that.  But since we then use the
      name length to create the directory entry record length, let's make sure
      it actually is half-way sensible.
      
      Note how POSIX states that the size of a path component is limited by
      NAME_MAX, but we actually use PATH_MAX for the check here.  That's
      because while NAME_MAX is generally the correct maximum name length
      (it's 255, for the same old "name length is usually just a byte on
      disk"), there's nothing in the VFS layer that really cares.
      
      So the real limitation at a VFS layer is the total pathname length you
      can pass as a filename: PATH_MAX.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2c6b7bcd
  5. 22 1月, 2020 1 次提交
    • J
      ceph: hold extra reference to r_parent over life of request · 9c1c2b35
      Jeff Layton 提交于
      Currently, we just assume that it will stick around by virtue of the
      submitter's reference, but later patches will allow the syscall to
      return early and we can't rely on that reference at that point.
      
      While I'm not aware of any reports of it, Xiubo pointed out that this
      may fix a use-after-free.  If the wait for a reply times out or is
      canceled via signal, and then the reply comes in after the syscall
      returns, the client can end up trying to access r_parent without a
      reference.
      
      Take an extra reference to the inode when setting r_parent and release
      it when releasing the request.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NJeff Layton <jlayton@kernel.org>
      Reviewed-by: N"Yan, Zheng" <zyan@redhat.com>
      Signed-off-by: NIlya Dryomov <idryomov@gmail.com>
      9c1c2b35
  6. 21 1月, 2020 1 次提交
  7. 17 1月, 2020 3 次提交
    • J
      btrfs: check rw_devices, not num_devices for balance · b35cf1f0
      Josef Bacik 提交于
      The fstest btrfs/154 reports
      
        [ 8675.381709] BTRFS: Transaction aborted (error -28)
        [ 8675.383302] WARNING: CPU: 1 PID: 31900 at fs/btrfs/block-group.c:2038 btrfs_create_pending_block_groups+0x1e0/0x1f0 [btrfs]
        [ 8675.390925] CPU: 1 PID: 31900 Comm: btrfs Not tainted 5.5.0-rc6-default+ #935
        [ 8675.392780] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-59-gc9ba527-rebuilt.opensuse.org 04/01/2014
        [ 8675.395452] RIP: 0010:btrfs_create_pending_block_groups+0x1e0/0x1f0 [btrfs]
        [ 8675.402672] RSP: 0018:ffffb2090888fb00 EFLAGS: 00010286
        [ 8675.404413] RAX: 0000000000000000 RBX: ffff92026dfa91c8 RCX: 0000000000000001
        [ 8675.406609] RDX: 0000000000000000 RSI: ffffffff8e100899 RDI: ffffffff8e100971
        [ 8675.408775] RBP: ffff920247c61660 R08: 0000000000000000 R09: 0000000000000000
        [ 8675.410978] R10: 0000000000000000 R11: 0000000000000000 R12: 00000000ffffffe4
        [ 8675.412647] R13: ffff92026db74000 R14: ffff920247c616b8 R15: ffff92026dfbc000
        [ 8675.413994] FS:  00007fd5e57248c0(0000) GS:ffff92027d800000(0000) knlGS:0000000000000000
        [ 8675.416146] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        [ 8675.417833] CR2: 0000564aa51682d8 CR3: 000000006dcbc004 CR4: 0000000000160ee0
        [ 8675.419801] Call Trace:
        [ 8675.420742]  btrfs_start_dirty_block_groups+0x355/0x480 [btrfs]
        [ 8675.422600]  btrfs_commit_transaction+0xc8/0xaf0 [btrfs]
        [ 8675.424335]  reset_balance_state+0x14a/0x190 [btrfs]
        [ 8675.425824]  btrfs_balance.cold+0xe7/0x154 [btrfs]
        [ 8675.427313]  ? kmem_cache_alloc_trace+0x235/0x2c0
        [ 8675.428663]  btrfs_ioctl_balance+0x298/0x350 [btrfs]
        [ 8675.430285]  btrfs_ioctl+0x466/0x2550 [btrfs]
        [ 8675.431788]  ? mem_cgroup_charge_statistics+0x51/0xf0
        [ 8675.433487]  ? mem_cgroup_commit_charge+0x56/0x400
        [ 8675.435122]  ? do_raw_spin_unlock+0x4b/0xc0
        [ 8675.436618]  ? _raw_spin_unlock+0x1f/0x30
        [ 8675.438093]  ? __handle_mm_fault+0x499/0x740
        [ 8675.439619]  ? do_vfs_ioctl+0x56e/0x770
        [ 8675.441034]  do_vfs_ioctl+0x56e/0x770
        [ 8675.442411]  ksys_ioctl+0x3a/0x70
        [ 8675.443718]  ? trace_hardirqs_off_thunk+0x1a/0x1c
        [ 8675.445333]  __x64_sys_ioctl+0x16/0x20
        [ 8675.446705]  do_syscall_64+0x50/0x210
        [ 8675.448059]  entry_SYSCALL_64_after_hwframe+0x49/0xbe
        [ 8675.479187] BTRFS: error (device vdb) in btrfs_create_pending_block_groups:2038: errno=-28 No space left
      
      We now use btrfs_can_overcommit() to see if we can flip a block group
      read only.  Before this would fail because we weren't taking into
      account the usable un-allocated space for allocating chunks.  With my
      patches we were allowed to do the balance, which is technically correct.
      
      The test is trying to start balance on degraded mount.  So now we're
      trying to allocate a chunk and cannot because we want to allocate a
      RAID1 chunk, but there's only 1 device that's available for usage.  This
      results in an ENOSPC.
      
      But we shouldn't even be making it this far, we don't have enough
      devices to restripe.  The problem is we're using btrfs_num_devices(),
      that also includes missing devices. That's not actually what we want, we
      need to use rw_devices.
      
      The chunk_mutex is not needed here, rw_devices changes only in device
      add, remove or replace, all are excluded by EXCL_OP mechanism.
      
      Fixes: e4d8ec0f ("Btrfs: implement online profile changing")
      CC: stable@vger.kernel.org # 4.4+
      Signed-off-by: NJosef Bacik <josef@toxicpanda.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      [ add stacktrace, update changelog, drop chunk_mutex ]
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      b35cf1f0
    • F
      Btrfs: always copy scrub arguments back to user space · 5afe6ce7
      Filipe Manana 提交于
      If scrub returns an error we are not copying back the scrub arguments
      structure to user space. This prevents user space to know how much
      progress scrub has done if an error happened - this includes -ECANCELED
      which is returned when users ask for scrub to stop. A particular use
      case, which is used in btrfs-progs, is to resume scrub after it is
      canceled, in that case it relies on checking the progress from the scrub
      arguments structure and then use that progress in a call to resume
      scrub.
      
      So fix this by always copying the scrub arguments structure to user
      space, overwriting the value returned to user space with -EFAULT only if
      copying the structure failed to let user space know that either that
      copying did not happen, and therefore the structure is stale, or it
      happened partially and the structure is probably not valid and corrupt
      due to the partial copy.
      Reported-by: NGraham Cobb <g.btrfs@cobb.uk.net>
      Link: https://lore.kernel.org/linux-btrfs/d0a97688-78be-08de-ca7d-bcb4c7fb397e@cobb.uk.net/
      Fixes: 06fe39ab ("Btrfs: do not overwrite scrub error with fault error in scrub ioctl")
      CC: stable@vger.kernel.org # 5.1+
      Reviewed-by: NJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Reviewed-by: NQu Wenruo <wqu@suse.com>
      Tested-by: NGraham Cobb <g.btrfs@cobb.uk.net>
      Signed-off-by: NFilipe Manana <fdmanana@suse.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      5afe6ce7
    • J
      io_uring: only allow submit from owning task · 44d28279
      Jens Axboe 提交于
      If the credentials or the mm doesn't match, don't allow the task to
      submit anything on behalf of this ring. The task that owns the ring can
      pass the file descriptor to another task, but we don't want to allow
      that task to submit an SQE that then assumes the ring mm and creds if
      it needs to go async.
      
      Cc: stable@vger.kernel.org
      Suggested-by: NStefan Metzmacher <metze@samba.org>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      44d28279
  8. 16 1月, 2020 4 次提交
  9. 15 1月, 2020 6 次提交
  10. 14 1月, 2020 2 次提交
    • J
      io_uring: don't setup async context for read/write fixed · 74566df3
      Jens Axboe 提交于
      We don't need it, and if we have it, then the retry handler will attempt
      to copy the non-existent iovec with the inline iovec, with a segment
      count that doesn't make sense.
      
      Fixes: f67676d1 ("io_uring: ensure async punted read/write requests copy iovec")
      Reported-by: NJonathan Lemon <jonathan.lemon@gmail.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      74566df3
    • Q
      btrfs: relocation: fix reloc_root lifespan and access · 6282675e
      Qu Wenruo 提交于
      [BUG]
      There are several different KASAN reports for balance + snapshot
      workloads.  Involved call paths include:
      
         should_ignore_root+0x54/0xb0 [btrfs]
         build_backref_tree+0x11af/0x2280 [btrfs]
         relocate_tree_blocks+0x391/0xb80 [btrfs]
         relocate_block_group+0x3e5/0xa00 [btrfs]
         btrfs_relocate_block_group+0x240/0x4d0 [btrfs]
         btrfs_relocate_chunk+0x53/0xf0 [btrfs]
         btrfs_balance+0xc91/0x1840 [btrfs]
         btrfs_ioctl_balance+0x416/0x4e0 [btrfs]
         btrfs_ioctl+0x8af/0x3e60 [btrfs]
         do_vfs_ioctl+0x831/0xb10
      
         create_reloc_root+0x9f/0x460 [btrfs]
         btrfs_reloc_post_snapshot+0xff/0x6c0 [btrfs]
         create_pending_snapshot+0xa9b/0x15f0 [btrfs]
         create_pending_snapshots+0x111/0x140 [btrfs]
         btrfs_commit_transaction+0x7a6/0x1360 [btrfs]
         btrfs_mksubvol+0x915/0x960 [btrfs]
         btrfs_ioctl_snap_create_transid+0x1d5/0x1e0 [btrfs]
         btrfs_ioctl_snap_create_v2+0x1d3/0x270 [btrfs]
         btrfs_ioctl+0x241b/0x3e60 [btrfs]
         do_vfs_ioctl+0x831/0xb10
      
         btrfs_reloc_pre_snapshot+0x85/0xc0 [btrfs]
         create_pending_snapshot+0x209/0x15f0 [btrfs]
         create_pending_snapshots+0x111/0x140 [btrfs]
         btrfs_commit_transaction+0x7a6/0x1360 [btrfs]
         btrfs_mksubvol+0x915/0x960 [btrfs]
         btrfs_ioctl_snap_create_transid+0x1d5/0x1e0 [btrfs]
         btrfs_ioctl_snap_create_v2+0x1d3/0x270 [btrfs]
         btrfs_ioctl+0x241b/0x3e60 [btrfs]
         do_vfs_ioctl+0x831/0xb10
      
      [CAUSE]
      All these call sites are only relying on root->reloc_root, which can
      undergo btrfs_drop_snapshot(), and since we don't have real refcount
      based protection to reloc roots, we can reach already dropped reloc
      root, triggering KASAN.
      
      [FIX]
      To avoid such access to unstable root->reloc_root, we should check
      BTRFS_ROOT_DEAD_RELOC_TREE bit first.
      
      This patch introduces wrappers that provide the correct way to check the
      bit with memory barriers protection.
      
      Most callers don't distinguish merged reloc tree and no reloc tree.  The
      only exception is should_ignore_root(), as merged reloc tree can be
      ignored, while no reloc tree shouldn't.
      
      [CRITICAL SECTION ANALYSIS]
      Although test_bit()/set_bit()/clear_bit() doesn't imply a barrier, the
      DEAD_RELOC_TREE bit has extra help from transaction as a higher level
      barrier, the lifespan of root::reloc_root and DEAD_RELOC_TREE bit are:
      
      	NULL: reloc_root is NULL	PTR: reloc_root is not NULL
      	0: DEAD_RELOC_ROOT bit not set	DEAD: DEAD_RELOC_ROOT bit set
      
      	(NULL, 0)    Initial state		 __
      	  |					 /\ Section A
              btrfs_init_reloc_root()			 \/
      	  |				 	 __
      	(PTR, 0)     reloc_root initialized      /\
                |					 |
      	btrfs_update_reloc_root()		 |  Section B
                |					 |
      	(PTR, DEAD)  reloc_root has been merged  \/
                |					 __
      	=== btrfs_commit_transaction() ====================
      	  |					 /\
      	clean_dirty_subvols()			 |
      	  |					 |  Section C
      	(NULL, DEAD) reloc_root cleanup starts   \/
                |					 __
      	btrfs_drop_snapshot()			 /\
      	  |					 |  Section D
      	(NULL, 0)    Back to initial state	 \/
      
      Every have_reloc_root() or test_bit(DEAD_RELOC_ROOT) caller holds
      transaction handle, so none of such caller can cross transaction boundary.
      
      In Section A, every caller just found no DEAD bit, and grab reloc_root.
      
      In the cross section A-B, caller may get no DEAD bit, but since reloc_root
      is still completely valid thus accessing reloc_root is completely safe.
      
      No test_bit() caller can cross the boundary of Section B and Section C.
      
      In Section C, every caller found the DEAD bit, so no one will access
      reloc_root.
      
      In the cross section C-D, either caller gets the DEAD bit set, avoiding
      access reloc_root no matter if it's safe or not.  Or caller get the DEAD
      bit cleared, then access reloc_root, which is already NULL, nothing will
      be wrong.
      
      The memory write barriers are between the reloc_root updates and bit
      set/clear, the pairing read side is before test_bit.
      Reported-by: NZygo Blaxell <ce3g8jdj@umail.furryterror.org>
      Fixes: d2311e69 ("btrfs: relocation: Delay reloc tree deletion after merge_reloc_roots")
      CC: stable@vger.kernel.org # 5.4+
      Reviewed-by: NJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: NQu Wenruo <wqu@suse.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      [ barriers ]
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      6282675e
  11. 09 1月, 2020 3 次提交
    • M
      fs: move guard_bio_eod() after bio_set_op_attrs · 83c9c547
      Ming Lei 提交于
      Commit 85a8ce62 ("block: add bio_truncate to fix guard_bio_eod")
      adds bio_truncate() for handling bio EOD. However, bio_truncate()
      doesn't use the passed 'op' parameter from guard_bio_eod's callers.
      
      So bio_trunacate() may retrieve wrong 'op', and zering pages may
      not be done for READ bio.
      
      Fixes this issue by moving guard_bio_eod() after bio_set_op_attrs()
      in submit_bh_wbc() so that bio_truncate() can always retrieve correct
      op info.
      
      Meantime remove the 'op' parameter from guard_bio_eod() because it isn't
      used any more.
      
      Cc: Carlos Maiolino <cmaiolino@redhat.com>
      Cc: linux-fsdevel@vger.kernel.org
      Fixes: 85a8ce62 ("block: add bio_truncate to fix guard_bio_eod")
      Signed-off-by: NMing Lei <ming.lei@redhat.com>
      
      Fold in kerneldoc and bio_op() change.
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      83c9c547
    • K
      pstore/ram: Regularize prz label allocation lifetime · e163fdb3
      Kees Cook 提交于
      In my attempt to fix a memory leak, I introduced a double-free in the
      pstore error path. Instead of trying to manage the allocation lifetime
      between persistent_ram_new() and its callers, adjust the logic so
      persistent_ram_new() always takes a kstrdup() copy, and leaves the
      caller's allocation lifetime up to the caller. Therefore callers are
      _always_ responsible for freeing their label. Before, it only needed
      freeing when the prz itself failed to allocate, and not in any of the
      other prz failure cases, which callers would have no visibility into,
      which is the root design problem that lead to both the leak and now
      double-free bugs.
      Reported-by: NCengiz Can <cengiz@kernel.wtf>
      Link: https://lore.kernel.org/lkml/d4ec59002ede4aaf9928c7f7526da87c@kernel.wtf
      Fixes: 8df955a3 ("pstore/ram: Fix error-path memory leak in persistent_ram_new() callers")
      Cc: stable@vger.kernel.org
      Signed-off-by: NKees Cook <keescook@chromium.org>
      e163fdb3
    • J
      btrfs: fix memory leak in qgroup accounting · 26ef8493
      Johannes Thumshirn 提交于
      When running xfstests on the current btrfs I get the following splat from
      kmemleak:
      
      unreferenced object 0xffff88821b2404e0 (size 32):
        comm "kworker/u4:7", pid 26663, jiffies 4295283698 (age 8.776s)
        hex dump (first 32 bytes):
          01 00 00 00 00 00 00 00 10 ff fd 26 82 88 ff ff  ...........&....
          10 ff fd 26 82 88 ff ff 20 ff fd 26 82 88 ff ff  ...&.... ..&....
        backtrace:
          [<00000000f94fd43f>] ulist_alloc+0x25/0x60 [btrfs]
          [<00000000fd023d99>] btrfs_find_all_roots_safe+0x41/0x100 [btrfs]
          [<000000008f17bd32>] btrfs_find_all_roots+0x52/0x70 [btrfs]
          [<00000000b7660afb>] btrfs_qgroup_rescan_worker+0x343/0x680 [btrfs]
          [<0000000058e66778>] btrfs_work_helper+0xac/0x1e0 [btrfs]
          [<00000000f0188930>] process_one_work+0x1cf/0x350
          [<00000000af5f2f8e>] worker_thread+0x28/0x3c0
          [<00000000b55a1add>] kthread+0x109/0x120
          [<00000000f88cbd17>] ret_from_fork+0x35/0x40
      
      This corresponds to:
      
        (gdb) l *(btrfs_find_all_roots_safe+0x41)
        0x8d7e1 is in btrfs_find_all_roots_safe (fs/btrfs/backref.c:1413).
        1408
        1409            tmp = ulist_alloc(GFP_NOFS);
        1410            if (!tmp)
        1411                    return -ENOMEM;
        1412            *roots = ulist_alloc(GFP_NOFS);
        1413            if (!*roots) {
        1414                    ulist_free(tmp);
        1415                    return -ENOMEM;
        1416            }
        1417
      
      Following the lifetime of the allocated 'roots' ulist, it gets freed
      again in btrfs_qgroup_account_extent().
      
      But this does not happen if the function is called with the
      'BTRFS_FS_QUOTA_ENABLED' flag cleared, then btrfs_qgroup_account_extent()
      does a short leave and directly returns.
      
      Instead of directly returning we should jump to the 'out_free' in order to
      free all resources as expected.
      
      CC: stable@vger.kernel.org # 4.14+
      Reviewed-by: NQu Wenruo <wqu@suse.com>
      Signed-off-by: NJohannes Thumshirn <johannes.thumshirn@wdc.com>
      [ add comment ]
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      26ef8493
  12. 08 1月, 2020 4 次提交
    • J
      btrfs: do not delete mismatched root refs · 423a716c
      Josef Bacik 提交于
      btrfs_del_root_ref() will simply WARN_ON() if the ref doesn't match in
      any way, and then continue to delete the reference.  This shouldn't
      happen, we have these values because there's more to the reference than
      the original root and the sub root.  If any of these checks fail, return
      -ENOENT.
      
      CC: stable@vger.kernel.org # 4.4+
      Signed-off-by: NJosef Bacik <josef@toxicpanda.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      423a716c
    • J
      btrfs: fix invalid removal of root ref · d49d3287
      Josef Bacik 提交于
      If we have the following sequence of events
      
        btrfs sub create A
        btrfs sub create A/B
        btrfs sub snap A C
        mkdir C/foo
        mv A/B C/foo
        rm -rf *
      
      We will end up with a transaction abort.
      
      The reason for this is because we create a root ref for B pointing to A.
      When we create a snapshot of C we still have B in our tree, but because
      the root ref points to A and not C we will make it appear to be empty.
      
      The problem happens when we move B into C.  This removes the root ref
      for B pointing to A and adds a ref of B pointing to C.  When we rmdir C
      we'll see that we have a ref to our root and remove the root ref,
      despite not actually matching our reference name.
      
      Now btrfs_del_root_ref() allowing this to work is a bug as well, however
      we know that this inode does not actually point to a root ref in the
      first place, so we shouldn't be calling btrfs_del_root_ref() in the
      first place and instead simply look up our dir index for this item and
      do the rest of the removal.
      
      CC: stable@vger.kernel.org # 4.4+
      Signed-off-by: NJosef Bacik <josef@toxicpanda.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      d49d3287
    • J
      btrfs: rework arguments of btrfs_unlink_subvol · 045d3967
      Josef Bacik 提交于
      btrfs_unlink_subvol takes the name of the dentry and the root objectid
      based on what kind of inode this is, either a real subvolume link or a
      empty one that we inherited as a snapshot.  We need to fix how we unlink
      in the case for BTRFS_EMPTY_SUBVOL_DIR_OBJECTID in the future, so rework
      btrfs_unlink_subvol to just take the dentry and handle getting the right
      objectid given the type of inode this is.  There is no functional change
      here, simply pushing the work into btrfs_unlink_subvol() proper.
      Signed-off-by: NJosef Bacik <josef@toxicpanda.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      045d3967
    • J
      io_uring: remove punt of short reads to async context · eacc6dfa
      Jens Axboe 提交于
      We currently punt any short read on a regular file to async context,
      but this fails if the short read is due to running into EOF. This is
      especially problematic since we only do the single prep for commands
      now, as we don't reset kiocb->ki_pos. This can result in a 4k read on
      a 1k file returning zero, as we detect the short read and then retry
      from async context. At the time of retry, the position is now 1k, and
      we end up reading nothing, and hence return 0.
      
      Instead of trying to patch around the fact that short reads can be
      legitimate and won't succeed in case of retry, remove the logic to punt
      a short read to async context. Simply return it.
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      eacc6dfa
  13. 07 1月, 2020 1 次提交
    • W
      chardev: Avoid potential use-after-free in 'chrdev_open()' · 68faa679
      Will Deacon 提交于
      'chrdev_open()' calls 'cdev_get()' to obtain a reference to the
      'struct cdev *' stashed in the 'i_cdev' field of the target inode
      structure. If the pointer is NULL, then it is initialised lazily by
      looking up the kobject in the 'cdev_map' and so the whole procedure is
      protected by the 'cdev_lock' spinlock to serialise initialisation of
      the shared pointer.
      
      Unfortunately, it is possible for the initialising thread to fail *after*
      installing the new pointer, for example if the subsequent '->open()' call
      on the file fails. In this case, 'cdev_put()' is called, the reference
      count on the kobject is dropped and, if nobody else has taken a reference,
      the release function is called which finally clears 'inode->i_cdev' from
      'cdev_purge()' before potentially freeing the object. The problem here
      is that a racing thread can happily take the 'cdev_lock' and see the
      non-NULL pointer in the inode, which can result in a refcount increment
      from zero and a warning:
      
        |  ------------[ cut here ]------------
        |  refcount_t: addition on 0; use-after-free.
        |  WARNING: CPU: 2 PID: 6385 at lib/refcount.c:25 refcount_warn_saturate+0x6d/0xf0
        |  Modules linked in:
        |  CPU: 2 PID: 6385 Comm: repro Not tainted 5.5.0-rc2+ #22
        |  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
        |  RIP: 0010:refcount_warn_saturate+0x6d/0xf0
        |  Code: 05 55 9a 15 01 01 e8 9d aa c8 ff 0f 0b c3 80 3d 45 9a 15 01 00 75 ce 48 c7 c7 00 9c 62 b3 c6 08
        |  RSP: 0018:ffffb524c1b9bc70 EFLAGS: 00010282
        |  RAX: 0000000000000000 RBX: ffff9e9da1f71390 RCX: 0000000000000000
        |  RDX: ffff9e9dbbd27618 RSI: ffff9e9dbbd18798 RDI: ffff9e9dbbd18798
        |  RBP: 0000000000000000 R08: 000000000000095f R09: 0000000000000039
        |  R10: 0000000000000000 R11: ffffb524c1b9bb20 R12: ffff9e9da1e8c700
        |  R13: ffffffffb25ee8b0 R14: 0000000000000000 R15: ffff9e9da1e8c700
        |  FS:  00007f3b87d26700(0000) GS:ffff9e9dbbd00000(0000) knlGS:0000000000000000
        |  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        |  CR2: 00007fc16909c000 CR3: 000000012df9c000 CR4: 00000000000006e0
        |  DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        |  DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
        |  Call Trace:
        |   kobject_get+0x5c/0x60
        |   cdev_get+0x2b/0x60
        |   chrdev_open+0x55/0x220
        |   ? cdev_put.part.3+0x20/0x20
        |   do_dentry_open+0x13a/0x390
        |   path_openat+0x2c8/0x1470
        |   do_filp_open+0x93/0x100
        |   ? selinux_file_ioctl+0x17f/0x220
        |   do_sys_open+0x186/0x220
        |   do_syscall_64+0x48/0x150
        |   entry_SYSCALL_64_after_hwframe+0x44/0xa9
        |  RIP: 0033:0x7f3b87efcd0e
        |  Code: 89 54 24 08 e8 a3 f4 ff ff 8b 74 24 0c 48 8b 3c 24 41 89 c0 44 8b 54 24 08 b8 01 01 00 00 89 f4
        |  RSP: 002b:00007f3b87d259f0 EFLAGS: 00000293 ORIG_RAX: 0000000000000101
        |  RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f3b87efcd0e
        |  RDX: 0000000000000000 RSI: 00007f3b87d25a80 RDI: 00000000ffffff9c
        |  RBP: 00007f3b87d25e90 R08: 0000000000000000 R09: 0000000000000000
        |  R10: 0000000000000000 R11: 0000000000000293 R12: 00007ffe188f504e
        |  R13: 00007ffe188f504f R14: 00007f3b87d26700 R15: 0000000000000000
        |  ---[ end trace 24f53ca58db8180a ]---
      
      Since 'cdev_get()' can already fail to obtain a reference, simply move
      it over to use 'kobject_get_unless_zero()' instead of 'kobject_get()',
      which will cause the racing thread to return -ENXIO if the initialising
      thread fails unexpectedly.
      
      Cc: Hillf Danton <hdanton@sina.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Reported-by: syzbot+82defefbbd8527e1c2cb@syzkaller.appspotmail.com
      Signed-off-by: NWill Deacon <will@kernel.org>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20191219120203.32691-1-will@kernel.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      68faa679
  14. 05 1月, 2020 6 次提交
    • G
      ocfs2: fix the crash due to call ocfs2_get_dlm_debug once less · b73eba2a
      Gang He 提交于
      Because ocfs2_get_dlm_debug() function is called once less here, ocfs2
      file system will trigger the system crash, usually after ocfs2 file
      system is unmounted.
      
      This system crash is caused by a generic memory corruption, these crash
      backtraces are not always the same, for exapmle,
      
          ocfs2: Unmounting device (253,16) on (node 172167785)
          general protection fault: 0000 [#1] SMP PTI
          CPU: 3 PID: 14107 Comm: fence_legacy Kdump:
          Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
          RIP: 0010:__kmalloc+0xa5/0x2a0
          Code: 00 00 4d 8b 07 65 4d 8b
          RSP: 0018:ffffaa1fc094bbe8 EFLAGS: 00010286
          RAX: 0000000000000000 RBX: d310a8800d7a3faf RCX: 0000000000000000
          RDX: 0000000000000000 RSI: 0000000000000dc0 RDI: ffff96e68fc036c0
          RBP: d310a8800d7a3faf R08: ffff96e6ffdb10a0 R09: 00000000752e7079
          R10: 000000000001c513 R11: 0000000004091041 R12: 0000000000000dc0
          R13: 0000000000000039 R14: ffff96e68fc036c0 R15: ffff96e68fc036c0
          FS:  00007f699dfba540(0000) GS:ffff96e6ffd80000(0000) knlGS:00000
          CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
          CR2: 000055f3a9d9b768 CR3: 000000002cd1c000 CR4: 00000000000006e0
          Call Trace:
           ext4_htree_store_dirent+0x35/0x100 [ext4]
           htree_dirblock_to_tree+0xea/0x290 [ext4]
           ext4_htree_fill_tree+0x1c1/0x2d0 [ext4]
           ext4_readdir+0x67c/0x9d0 [ext4]
           iterate_dir+0x8d/0x1a0
           __x64_sys_getdents+0xab/0x130
           do_syscall_64+0x60/0x1f0
           entry_SYSCALL_64_after_hwframe+0x49/0xbe
          RIP: 0033:0x7f699d33a9fb
      
      This regression problem was introduced by commit e581595e ("ocfs: no
      need to check return value of debugfs_create functions").
      
      Link: http://lkml.kernel.org/r/20191225061501.13587-1-ghe@suse.com
      Fixes: e581595e ("ocfs: no need to check return value of debugfs_create functions")
      Signed-off-by: NGang He <ghe@suse.com>
      Acked-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
      Cc: Mark Fasheh <mark@fasheh.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Junxiao Bi <junxiao.bi@oracle.com>
      Cc: Changwei Ge <gechangwei@live.cn>
      Cc: Gang He <ghe@suse.com>
      Cc: Jun Piao <piaojun@huawei.com>
      Cc: <stable@vger.kernel.org>	[5.3+]
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b73eba2a
    • K
      ocfs2: call journal flush to mark journal as empty after journal recovery when mount · 397eac17
      Kai Li 提交于
      If journal is dirty when mount, it will be replayed but jbd2 sb log tail
      cannot be updated to mark a new start because journal->j_flag has
      already been set with JBD2_ABORT first in journal_init_common.
      
      When a new transaction is committed, it will be recored in block 1
      first(journal->j_tail is set to 1 in journal_reset).  If emergency
      restart happens again before journal super block is updated
      unfortunately, the new recorded trans will not be replayed in the next
      mount.
      
      The following steps describe this procedure in detail.
      1. mount and touch some files
      2. these transactions are committed to journal area but not checkpointed
      3. emergency restart
      4. mount again and its journals are replayed
      5. journal super block's first s_start is 1, but its s_seq is not updated
      6. touch a new file and its trans is committed but not checkpointed
      7. emergency restart again
      8. mount and journal is dirty, but trans committed in 6 will not be
      replayed.
      
      This exception happens easily when this lun is used by only one node.
      If it is used by multi-nodes, other node will replay its journal and its
      journal super block will be updated after recovery like what this patch
      does.
      
      ocfs2_recover_node->ocfs2_replay_journal.
      
      The following jbd2 journal can be generated by touching a new file after
      journal is replayed, and seq 15 is the first valid commit, but first seq
      is 13 in journal super block.
      
      logdump:
        Block 0: Journal Superblock
        Seq: 0   Type: 4 (JBD2_SUPERBLOCK_V2)
        Blocksize: 4096   Total Blocks: 32768   First Block: 1
        First Commit ID: 13   Start Log Blknum: 1
        Error: 0
        Feature Compat: 0
        Feature Incompat: 2 block64
        Feature RO compat: 0
        Journal UUID: 4ED3822C54294467A4F8E87D2BA4BC36
        FS Share Cnt: 1   Dynamic Superblk Blknum: 0
        Per Txn Block Limit    Journal: 0    Data: 0
      
        Block 1: Journal Commit Block
        Seq: 14   Type: 2 (JBD2_COMMIT_BLOCK)
      
        Block 2: Journal Descriptor
        Seq: 15   Type: 1 (JBD2_DESCRIPTOR_BLOCK)
        No. Blocknum        Flags
         0. 587             none
        UUID: 00000000000000000000000000000000
         1. 8257792         JBD2_FLAG_SAME_UUID
         2. 619             JBD2_FLAG_SAME_UUID
         3. 24772864        JBD2_FLAG_SAME_UUID
         4. 8257802         JBD2_FLAG_SAME_UUID
         5. 513             JBD2_FLAG_SAME_UUID JBD2_FLAG_LAST_TAG
        ...
        Block 7: Inode
        Inode: 8257802   Mode: 0640   Generation: 57157641 (0x3682809)
        FS Generation: 2839773110 (0xa9437fb6)
        CRC32: 00000000   ECC: 0000
        Type: Regular   Attr: 0x0   Flags: Valid
        Dynamic Features: (0x1) InlineData
        User: 0 (root)   Group: 0 (root)   Size: 7
        Links: 1   Clusters: 0
        ctime: 0x5de5d870 0x11104c61 -- Tue Dec  3 11:37:20.286280801 2019
        atime: 0x5de5d870 0x113181a1 -- Tue Dec  3 11:37:20.288457121 2019
        mtime: 0x5de5d870 0x11104c61 -- Tue Dec  3 11:37:20.286280801 2019
        dtime: 0x0 -- Thu Jan  1 08:00:00 1970
        ...
        Block 9: Journal Commit Block
        Seq: 15   Type: 2 (JBD2_COMMIT_BLOCK)
      
      The following is journal recovery log when recovering the upper jbd2
      journal when mount again.
      
      syslog:
        ocfs2: File system on device (252,1) was not unmounted cleanly, recovering it.
        fs/jbd2/recovery.c:(do_one_pass, 449): Starting recovery pass 0
        fs/jbd2/recovery.c:(do_one_pass, 449): Starting recovery pass 1
        fs/jbd2/recovery.c:(do_one_pass, 449): Starting recovery pass 2
        fs/jbd2/recovery.c:(jbd2_journal_recover, 278): JBD2: recovery, exit status 0, recovered transactions 13 to 13
      
      Due to first commit seq 13 recorded in journal super is not consistent
      with the value recorded in block 1(seq is 14), journal recovery will be
      terminated before seq 15 even though it is an unbroken commit, inode
      8257802 is a new file and it will be lost.
      
      Link: http://lkml.kernel.org/r/20191217020140.2197-1-li.kai4@h3c.comSigned-off-by: NKai Li <li.kai4@h3c.com>
      Reviewed-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
      Reviewed-by: NChangwei Ge <gechangwei@live.cn>
      Cc: Mark Fasheh <mark@fasheh.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Junxiao Bi <junxiao.bi@oracle.com>
      Cc: Gang He <ghe@suse.com>
      Cc: Jun Piao <piaojun@huawei.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      397eac17
    • R
      fs/posix_acl.c: fix kernel-doc warnings · e39e773a
      Randy Dunlap 提交于
      Fix kernel-doc warnings in fs/posix_acl.c.
      Also fix one typo (setgit -> setgid).
      
        fs/posix_acl.c:647: warning: Function parameter or member 'inode' not described in 'posix_acl_update_mode'
        fs/posix_acl.c:647: warning: Function parameter or member 'mode_p' not described in 'posix_acl_update_mode'
        fs/posix_acl.c:647: warning: Function parameter or member 'acl' not described in 'posix_acl_update_mode'
      
      Link: http://lkml.kernel.org/r/29b0dc46-1f28-a4e5-b1d0-ba2b65629779@infradead.org
      Fixes: 07393101 ("posix_acl: Clear SGID bit when setting file permissions")
      Signed-off-by: NRandy Dunlap <rdunlap@infradead.org>
      Acked-by: NAndreas Gruenbacher <agruenba@redhat.com>
      Reviewed-by: NJan Kara <jack@suse.cz>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Andreas Gruenbacher <agruenba@redhat.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e39e773a
    • E
      fs/namespace.c: make to_mnt_ns() static · 213921f9
      Eric Biggers 提交于
      Make to_mnt_ns() static to address the following 'sparse' warning:
      
          fs/namespace.c:1731:22: warning: symbol 'to_mnt_ns' was not declared. Should it be static?
      
      Link: http://lkml.kernel.org/r/20191209234830.156260-1-ebiggers@kernel.orgSigned-off-by: NEric Biggers <ebiggers@google.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      213921f9
    • E
      fs/nsfs.c: include headers for missing declarations · 7bebd69e
      Eric Biggers 提交于
      Include linux/proc_fs.h and fs/internal.h to address the following
      'sparse' warnings:
      
          fs/nsfs.c:41:32: warning: symbol 'ns_dentry_operations' was not declared. Should it be static?
          fs/nsfs.c:145:5: warning: symbol 'open_related_ns' was not declared. Should it be static?
      
      Link: http://lkml.kernel.org/r/20191209234822.156179-1-ebiggers@kernel.orgSigned-off-by: NEric Biggers <ebiggers@google.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      7bebd69e
    • E
      fs/direct-io.c: include fs/internal.h for missing prototype · b16155a0
      Eric Biggers 提交于
      Include fs/internal.h to address the following 'sparse' warning:
      
          fs/direct-io.c:591:5: warning: symbol 'sb_init_dio_done_wq' was not declared. Should it be static?
      
      Link: http://lkml.kernel.org/r/20191209234544.128302-1-ebiggers@kernel.orgSigned-off-by: NEric Biggers <ebiggers@google.com>
      Reviewed-by: NJan Kara <jack@suse.cz>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b16155a0
  15. 04 1月, 2020 1 次提交