1. 18 7月, 2017 1 次提交
    • E
      reiserfs: preserve i_mode if __reiserfs_set_acl() fails · fcea8aed
      Ernesto A. Fernández 提交于
      When changing a file's acl mask, reiserfs_set_acl() will first set the
      group bits of i_mode to the value of the mask, and only then set the
      actual extended attribute representing the new acl.
      
      If the second part fails (due to lack of space, for example) and the
      file had no acl attribute to begin with, the system will from now on
      assume that the mask permission bits are actual group permission bits,
      potentially granting access to the wrong users.
      
      Prevent this by only changing the inode mode after the acl has been set.
      Signed-off-by: NErnesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      fcea8aed
  2. 17 7月, 2017 1 次提交
    • J
      reiserfs: Don't clear SGID when inheriting ACLs · 6883cd7f
      Jan Kara 提交于
      When new directory 'DIR1' is created in a directory 'DIR0' with SGID bit
      set, DIR1 is expected to have SGID bit set (and owning group equal to
      the owning group of 'DIR0'). However when 'DIR0' also has some default
      ACLs that 'DIR1' inherits, setting these ACLs will result in SGID bit on
      'DIR1' to get cleared if user is not member of the owning group.
      
      Fix the problem by moving posix_acl_update_mode() out of
      __reiserfs_set_acl() into reiserfs_set_acl(). That way the function will
      not be called when inheriting ACLs which is what we want as it prevents
      SGID bit clearing and the mode has been properly set by
      posix_acl_create() anyway.
      
      Fixes: 07393101
      CC: stable@vger.kernel.org
      CC: reiserfs-devel@vger.kernel.org
      Signed-off-by: NJan Kara <jack@suse.cz>
      6883cd7f
  3. 06 7月, 2017 1 次提交
    • D
      VFS: Don't use save/replace_mount_options if not using generic_show_options · c3d98ea0
      David Howells 提交于
      btrfs, debugfs, reiserfs and tracefs call save_mount_options() and reiserfs
      calls replace_mount_options(), but they then implement their own
      ->show_options() methods and don't touch s_options, rendering the saved
      options unnecessary.  I'm trying to eliminate s_options to make it easier
      to implement a context-based mount where the mount options can be passed
      individually over a file descriptor.
      
      Remove the calls to save/replace_mount_options() call in these cases.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      cc: Chris Mason <clm@fb.com>
      cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      cc: Steven Rostedt <rostedt@goodmis.org>
      cc: linux-btrfs@vger.kernel.org
      cc: reiserfs-devel@vger.kernel.org
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      c3d98ea0
  4. 23 6月, 2017 2 次提交
    • J
      reiserfs: fix race in prealloc discard · 08db141b
      Jeff Mahoney 提交于
      The main loop in __discard_prealloc is protected by the reiserfs write lock
      which is dropped across schedules like the BKL it replaced.  The problem is
      that it checks the value, calls a routine that schedules, and then adjusts
      the state.  As a result, two threads that are calling
      reiserfs_prealloc_discard at the same time can race when one calls
      reiserfs_free_prealloc_block, the lock is dropped, and the other calls
      reiserfs_free_prealloc_block with the same block number.  In the right
      circumstances, it can cause the prealloc count to go negative.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      08db141b
    • J
      reiserfs: don't preallocate blocks for extended attributes · 54930dfe
      Jeff Mahoney 提交于
      Most extended attributes will fit in a single block.  More importantly,
      we drop the reference to the inode while holding the transaction open
      so the preallocated blocks aren't released.  As a result, the inode
      may be evicted before it's removed from the transaction's prealloc list
      which can cause memory corruption.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      54930dfe
  5. 20 6月, 2017 1 次提交
    • I
      sched/wait: Rename wait_queue_t => wait_queue_entry_t · ac6424b9
      Ingo Molnar 提交于
      Rename:
      
      	wait_queue_t		=>	wait_queue_entry_t
      
      'wait_queue_t' was always a slight misnomer: its name implies that it's a "queue",
      but in reality it's a queue *entry*. The 'real' queue is the wait queue head,
      which had to carry the name.
      
      Start sorting this out by renaming it to 'wait_queue_entry_t'.
      
      This also allows the real structure name 'struct __wait_queue' to
      lose its double underscore and become 'struct wait_queue_entry',
      which is the more canonical nomenclature for such data types.
      
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      ac6424b9
  6. 24 5月, 2017 1 次提交
    • J
      reiserfs: Make flush bios explicitely sync · d8747d64
      Jan Kara 提交于
      Commit b685d3d6 "block: treat REQ_FUA and REQ_PREFLUSH as
      synchronous" removed REQ_SYNC flag from WRITE_{FUA|PREFLUSH|...}
      definitions.  generic_make_request_checks() however strips REQ_FUA and
      REQ_PREFLUSH flags from a bio when the storage doesn't report volatile
      write cache and thus write effectively becomes asynchronous which can
      lead to performance regressions
      
      Fix the problem by making sure all bios which are synchronous are
      properly marked with REQ_SYNC.
      
      Fixes: b685d3d6
      CC: reiserfs-devel@vger.kernel.org
      CC: stable@vger.kernel.org
      Signed-off-by: NJan Kara <jack@suse.cz>
      d8747d64
  7. 09 5月, 2017 1 次提交
  8. 19 4月, 2017 3 次提交
    • J
      reiserfs: Remove i_attrs_to_sd_attrs() · a480b5be
      Jan Kara 提交于
      Now that all places setting inode->i_flags that should be reflected in
      on-disk flags are gone, we can remove i_attrs_to_sd_attrs() call.
      Signed-off-by: NJan Kara <jack@suse.cz>
      a480b5be
    • J
      reiserfs: Remove useless setting of i_flags · a73415a8
      Jan Kara 提交于
      reiserfs_new_inode() clears IMMUTABLE and APPEND flags from a symlink
      i_flags however a few lines below in sd_attrs_to_i_attrs() we will
      happily overwrite i_flags with whatever we inherited from the directory.
      Since this behavior is there for ages just remove the useless setting of
      i_flags.
      Signed-off-by: NJan Kara <jack@suse.cz>
      a73415a8
    • J
      reiserfs: Set flags on quota files directly · 33eb928a
      Jan Kara 提交于
      Currently immutable and noatime flags on quota files are set by quota
      code which requires us to copy inode->i_flags to our on disk version of
      quota flags in GETFLAGS ioctl and when writing stat item. Move to
      setting / clearing these on-disk flags directly to save that copying.
      Signed-off-by: NJan Kara <jack@suse.cz>
      33eb928a
  9. 05 4月, 2017 2 次提交
    • J
      reiserfs: Protect dquot_writeback_dquots() by s_umount semaphore · 1e0e653f
      Jan Kara 提交于
      dquot_writeback_dquots() expects s_umount semaphore to be held to
      protect it from other concurrent quota operations. reiserfs_sync_fs()
      can call dquot_writeback_dquots() without holding s_umount semaphore
      when called from flush_old_commits().
      
      Fix the problem by grabbing s_umount in flush_old_commits(). However we
      have to be careful and use only trylock since reiserfs_cancel_old_sync()
      can be waiting for flush_old_commits() to complete while holding
      s_umount semaphore. Possible postponing of sync work is not a big deal
      though as that is only an opportunistic flush.
      
      Fixes: 9d1ccbe7Reported-by: NJan Beulich <jbeulich@suse.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      1e0e653f
    • J
      reiserfs: Make cancel_old_flush() reliable · 71b0576b
      Jan Kara 提交于
      Currently canceling of delayed work that flushes old data using
      cancel_old_flush() does not prevent work from being requeued. Thus
      in theory new work can be queued after cancel_old_flush() from
      reiserfs_freeze() has run. This will become larger problem once
      flush_old_commits() can requeue the work itself.
      
      Fix the problem by recording in sbi->work_queue that flushing work is
      canceled and should not be requeued.
      Signed-off-by: NJan Kara <jack@suse.cz>
      71b0576b
  10. 24 3月, 2017 1 次提交
    • A
      reiserfs: avoid a -Wmaybe-uninitialized warning · ab494964
      Arnd Bergmann 提交于
      The latest gcc-7.0.1 snapshot warns about an unintialized variable use:
      
      In file included from fs/reiserfs/lbalance.c:8:0:
      fs/reiserfs/lbalance.c: In function 'leaf_item_bottle.isra.3':
      fs/reiserfs/reiserfs.h:1279:13: error: '*((void *)&n_ih+8).v' may be used uninitialized in this function [-Werror=maybe-uninitialized]
        v2->v = (v2->v & cpu_to_le64(15ULL << 60)) | cpu_to_le64(offset);
                 ~~^~~
      fs/reiserfs/reiserfs.h:1279:13: error: '*((void *)&n_ih+8).v' may be used uninitialized in this function [-Werror=maybe-uninitialized]
        v2->v = (v2->v & cpu_to_le64(15ULL << 60)) | cpu_to_le64(offset);
      
      This happens because the offset/type pair that is stored in
      ih.key.u.k_offset_v2 is actually uninitialized when we call
      set_le_ih_k_offset() and set_le_ih_k_type(). After we have called both,
      all data is correct, but the first of the two reads uninitialized data
      for the type field and writes it back before it gets overwritten.
      
      This works around the warning by initializing the k_offset_v2 through
      the slightly larger memcpy().
      
      [JK: Remove now unused define and make it obvious we initialize the key]
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NJan Kara <jack@suse.cz>
      ab494964
  11. 28 2月, 2017 2 次提交
  12. 09 12月, 2016 1 次提交
  13. 06 12月, 2016 1 次提交
  14. 01 11月, 2016 3 次提交
  15. 08 10月, 2016 1 次提交
  16. 28 9月, 2016 1 次提交
  17. 27 9月, 2016 2 次提交
  18. 22 9月, 2016 2 次提交
  19. 16 9月, 2016 1 次提交
    • M
      reiserfs: Unlock superblock before calling reiserfs_quota_on_mount() · 420902c9
      Mike Galbraith 提交于
      If we hold the superblock lock while calling reiserfs_quota_on_mount(), we can
      deadlock our own worker - mount blocks kworker/3:2, sleeps forever more.
      
      crash> ps|grep UN
          715      2   3  ffff880220734d30  UN   0.0       0      0  [kworker/3:2]
         9369   9341   2  ffff88021ffb7560  UN   1.3  493404 123184  Xorg
         9665   9664   3  ffff880225b92ab0  UN   0.0   47368    812  udisks-daemon
        10635  10403   3  ffff880222f22c70  UN   0.0   14904    936  mount
      crash> bt ffff880220734d30
      PID: 715    TASK: ffff880220734d30  CPU: 3   COMMAND: "kworker/3:2"
       #0 [ffff8802244c3c20] schedule at ffffffff8144584b
       #1 [ffff8802244c3cc8] __rt_mutex_slowlock at ffffffff814472b3
       #2 [ffff8802244c3d28] rt_mutex_slowlock at ffffffff814473f5
       #3 [ffff8802244c3dc8] reiserfs_write_lock at ffffffffa05f28fd [reiserfs]
       #4 [ffff8802244c3de8] flush_async_commits at ffffffffa05ec91d [reiserfs]
       #5 [ffff8802244c3e08] process_one_work at ffffffff81073726
       #6 [ffff8802244c3e68] worker_thread at ffffffff81073eba
       #7 [ffff8802244c3ec8] kthread at ffffffff810782e0
       #8 [ffff8802244c3f48] kernel_thread_helper at ffffffff81450064
      crash> rd ffff8802244c3cc8 10
      ffff8802244c3cc8:  ffffffff814472b3 ffff880222f23250   .rD.....P2."....
      ffff8802244c3cd8:  0000000000000000 0000000000000286   ................
      ffff8802244c3ce8:  ffff8802244c3d30 ffff880220734d80   0=L$.....Ms ....
      ffff8802244c3cf8:  ffff880222e8f628 0000000000000000   (.."............
      ffff8802244c3d08:  0000000000000000 0000000000000002   ................
      crash> struct rt_mutex ffff880222e8f628
      struct rt_mutex {
        wait_lock = {
          raw_lock = {
            slock = 65537
          }
        },
        wait_list = {
          node_list = {
            next = 0xffff8802244c3d48,
            prev = 0xffff8802244c3d48
          }
        },
        owner = 0xffff880222f22c71,
        save_state = 0
      }
      crash> bt 0xffff880222f22c70
      PID: 10635  TASK: ffff880222f22c70  CPU: 3   COMMAND: "mount"
       #0 [ffff8802216a9868] schedule at ffffffff8144584b
       #1 [ffff8802216a9910] schedule_timeout at ffffffff81446865
       #2 [ffff8802216a99a0] wait_for_common at ffffffff81445f74
       #3 [ffff8802216a9a30] flush_work at ffffffff810712d3
       #4 [ffff8802216a9ab0] schedule_on_each_cpu at ffffffff81074463
       #5 [ffff8802216a9ae0] invalidate_bdev at ffffffff81178aba
       #6 [ffff8802216a9af0] vfs_load_quota_inode at ffffffff811a3632
       #7 [ffff8802216a9b50] dquot_quota_on_mount at ffffffff811a375c
       #8 [ffff8802216a9b80] finish_unfinished at ffffffffa05dd8b0 [reiserfs]
       #9 [ffff8802216a9cc0] reiserfs_fill_super at ffffffffa05de825 [reiserfs]
          RIP: 00007f7b9303997a  RSP: 00007ffff443c7a8  RFLAGS: 00010202
          RAX: 00000000000000a5  RBX: ffffffff8144ef12  RCX: 00007f7b932e9ee0
          RDX: 00007f7b93d9a400  RSI: 00007f7b93d9a3e0  RDI: 00007f7b93d9a3c0
          RBP: 00007f7b93d9a2c0   R8: 00007f7b93d9a550   R9: 0000000000000001
          R10: ffffffffc0ed040e  R11: 0000000000000202  R12: 000000000000040e
          R13: 0000000000000000  R14: 00000000c0ed040e  R15: 00007ffff443ca20
          ORIG_RAX: 00000000000000a5  CS: 0033  SS: 002b
      Signed-off-by: NMike Galbraith <efault@gmx.de>
      Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: NMike Galbraith <mgalbraith@suse.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NJan Kara <jack@suse.cz>
      420902c9
  20. 03 8月, 2016 1 次提交
  21. 21 7月, 2016 1 次提交
  22. 08 6月, 2016 2 次提交
  23. 28 5月, 2016 1 次提交
  24. 25 5月, 2016 1 次提交
    • M
      reiserfs: check kstrdup failure · b9d8905e
      Mikulas Patocka 提交于
      Check out-of-memory failure of the kstrdup option. Note that the argument
      "arg" may be NULL (in that case kstrup returns NULL), so out of memory
      condition happened if arg was non-NULL and kstrdup returned NULL.
      
      The patch also changes the call to replace_mount_options - if we didn't
      pass any filesystem-specific options, we don't call replace_mount_options
      (thus we don't erase existing reported options).
      
      Note that to properly report options after remount, the reiserfs
      filesystem should implement the show_options method. Without the
      show_options method, options changed with remount replace existing
      options.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      b9d8905e
  25. 21 5月, 2016 1 次提交
  26. 09 5月, 2016 1 次提交
  27. 03 5月, 2016 1 次提交
  28. 02 5月, 2016 1 次提交
  29. 11 4月, 2016 2 次提交