1. 07 5月, 2014 5 次提交
  2. 04 4月, 2014 3 次提交
  3. 03 4月, 2014 1 次提交
    • J
      reiserfs: fix race in readdir · 01d88857
      Jeff Mahoney 提交于
      jdm-20004 reiserfs_delete_xattrs: Couldn't delete all xattrs (-2)
      
      The -ENOENT is due to readdir calling dir_emit on the same entry twice.
      
      If the dir_emit callback sleeps and the tree is changed underneath us,
      we won't be able to trust deh_offset(deh) anymore. We need to save
      next_pos before we might sleep so we can find the next entry.
      
      CC: stable@vger.kernel.org
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      01d88857
  4. 13 3月, 2014 1 次提交
    • T
      fs: push sync_filesystem() down to the file system's remount_fs() · 02b9984d
      Theodore Ts'o 提交于
      Previously, the no-op "mount -o mount /dev/xxx" operation when the
      file system is already mounted read-write causes an implied,
      unconditional syncfs().  This seems pretty stupid, and it's certainly
      documented or guaraunteed to do this, nor is it particularly useful,
      except in the case where the file system was mounted rw and is getting
      remounted read-only.
      
      However, it's possible that there might be some file systems that are
      actually depending on this behavior.  In most file systems, it's
      probably fine to only call sync_filesystem() when transitioning from
      read-write to read-only, and there are some file systems where this is
      not needed at all (for example, for a pseudo-filesystem or something
      like romfs).
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      Cc: linux-fsdevel@vger.kernel.org
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Artem Bityutskiy <dedekind1@gmail.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Evgeniy Dushistov <dushistov@mail.ru>
      Cc: Jan Kara <jack@suse.cz>
      Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Cc: Anders Larsen <al@alarsen.net>
      Cc: Phillip Lougher <phillip@squashfs.org.uk>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
      Cc: Petr Vandrovec <petr@vandrovec.name>
      Cc: xfs@oss.sgi.com
      Cc: linux-btrfs@vger.kernel.org
      Cc: linux-cifs@vger.kernel.org
      Cc: samba-technical@lists.samba.org
      Cc: codalist@coda.cs.cmu.edu
      Cc: linux-ext4@vger.kernel.org
      Cc: linux-f2fs-devel@lists.sourceforge.net
      Cc: fuse-devel@lists.sourceforge.net
      Cc: cluster-devel@redhat.com
      Cc: linux-mtd@lists.infradead.org
      Cc: jfs-discussion@lists.sourceforge.net
      Cc: linux-nfs@vger.kernel.org
      Cc: linux-nilfs@vger.kernel.org
      Cc: linux-ntfs-dev@lists.sourceforge.net
      Cc: ocfs2-devel@oss.oracle.com
      Cc: reiserfs-devel@vger.kernel.org
      02b9984d
  5. 18 2月, 2014 1 次提交
    • D
      reiserfs: fix utterly brain-damaged indentation. · 416e2abd
      Dave Jones 提交于
      This has been this way for years, and every time I stumble across it I
      lose my lunch.  After coming across it for the nth time in the Coverity
      results, I had to overcome the bystander effect and do something about
      it.
      
      This ignores the 79 column limit in favor of making it look like C
      instead of gibberish.
      
      The correct thing to do here would be to lose some of the indentation by
      breaking this function up into several smaller ones.  I might do that at
      some point if I have the stomach to look at this again.
      
      (Also some of those overlong ternary operations would likely be more
      readable as regular if's)
      Signed-off-by: NDave Jones <davej@fedoraproject.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      416e2abd
  6. 26 1月, 2014 4 次提交
  7. 25 1月, 2014 1 次提交
  8. 24 1月, 2014 2 次提交
  9. 24 9月, 2013 2 次提交
    • J
      reiserfs: fix race with flush_used_journal_lists and flush_journal_list · 721a769c
      Jeff Mahoney 提交于
      There are two locks involved in managing the journal lists. The general
      reiserfs_write_lock and the journal->j_flush_mutex.
      
      While flush_journal_list is sleeping to acquire the j_flush_mutex or to
      submit a block for write, it will drop the write lock. This allows
      another thread to acquire the write lock and ultimately call
      flush_used_journal_lists to traverse the list of journal lists and
      select one for flushing. It can select the journal_list that has just
      had flush_journal_list called on it in the original thread and call it
      again with the same journal_list.
      
      The second thread then drops the write lock to acquire j_flush_mutex and
      the first thread reacquires it and continues execution and eventually
      clears and frees the journal list before dropping j_flush_mutex and
      returning.
      
      The second thread acquires j_flush_mutex and ends up operating on a
      journal_list that has already been released. If the memory hasn't
      been reused, we'll soon after hit a BUG_ON because the transaction id
      has already been cleared. If it's been reused, we'll crash in other
      fun ways.
      
      Since flush_journal_list will synchronize on j_flush_mutex, we can fix
      the race by taking a proper reference in flush_used_journal_lists
      and checking to see if it's still valid after the mutex is taken. It's
      safe to iterate the list of journal lists and pick a list with
      just the write lock as long as a reference is taken on the journal list
      before we drop the lock. We already have code to handle whether a
      transaction has been flushed already so we can use that to handle the
      race and get rid of the trans_id BUG_ON.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      721a769c
    • J
      reiserfs: remove useless flush_old_journal_lists · 7bc9cc07
      Jeff Mahoney 提交于
      Commit a3172027 introduced test_transaction as a requirement for
      flushing old lists -- but it can never return 1 unless the transaction
      has already been flushed.
      
      As a result, we have a routine that iterates the j_realblocks list but
      doesn't actually do anything. Since it's been this way since 2006 and
      the latency numbers were what Chris expected, let's just rip it out.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      7bc9cc07
  10. 09 8月, 2013 3 次提交
    • J
      reiserfs: locking, release lock around quota operations · d2d0395f
      Jeff Mahoney 提交于
      Previous commits released the write lock across quota operations but
      missed several places.  In particular, the free operations can also
      call into the file system code and take the write lock, causing
      deadlocks.
      
      This patch introduces some more helpers and uses them for quota call
      sites.  Without this patch applied, reiserfs + quotas runs into deadlocks
      under anything more than trivial load.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      d2d0395f
    • J
      reiserfs: locking, handle nested locks properly · 278f6679
      Jeff Mahoney 提交于
      The reiserfs write lock replaced the BKL and uses similar semantics.
      
      Frederic's locking code makes a distinction between when the lock is nested
      and when it's being acquired/released, but I don't think that's the right
      distinction to make.
      
      The right distinction is between the lock being released at end-of-use and
      the lock being released for a schedule. The unlock should return the depth
      and the lock should restore it, rather than the other way around as it is now.
      
      This patch implements that and adds a number of places where the lock
      should be dropped.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      278f6679
    • J
      reiserfs: locking, push write lock out of xattr code · 4c05141d
      Jeff Mahoney 提交于
      The reiserfs xattr code doesn't need the write lock and sleeps all over
      the place. We can simplify the locking by releasing it and reacquiring
      after the xattr call.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      4c05141d
  11. 05 8月, 2013 1 次提交
    • A
      reiserfs: fix deadlock in umount · 672fe15d
      Al Viro 提交于
      Since remove_proc_entry() started to wait for IO in progress (i.e.
      since 2007 or so), the locking in fs/reiserfs/proc.c became wrong;
      if procfs read happens between the moment when umount() locks the
      victim superblock and removal of /proc/fs/reiserfs/<device>/*,
      we'll get a deadlock - read will wait for s_umount (in sget(),
      called by r_start()), while umount will wait in remove_proc_entry()
      for that read to finish, holding s_umount all along.
      
      Fortunately, the same change allows a much simpler race avoidance -
      all we need to do is remove the procfs entries in the very beginning
      of reiserfs ->kill_sb(); that'll guarantee that pointer to superblock
      will remain valid for the duration for procfs IO, so we don't need
      sget() to keep the sucker alive.  As the matter of fact, we can
      get rid of the home-grown iterator completely, and use single_open()
      instead.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      672fe15d
  12. 29 6月, 2013 3 次提交
  13. 01 6月, 2013 3 次提交
    • J
      reiserfs: fix deadlock with nfs racing on create/lookup · a1457c0c
      Jeff Mahoney 提交于
      Reiserfs is currently able to be deadlocked by having two NFS clients
      where one has removed and recreated a file and another is accessing the
      file with an open file handle.
      
      If one client deletes and recreates a file with timing such that the
      recreated file obtains the same [dirid, objectid] pair as the original
      file while another client accesses the file via file handle, the create
      and lookup can race and deadlock if the lookup manages to create the
      in-memory inode first.
      
      The create thread, in insert_inode_locked4, will hold the write lock
      while waiting on the other inode to be unlocked. The lookup thread,
      anywhere in the iget path, will release and reacquire the write lock while
      it schedules. If it needs to reacquire the lock while the create thread
      has it, it will never be able to make forward progress because it needs
      to reacquire the lock before ultimately unlocking the inode.
      
      This patch drops the write lock across the insert_inode_locked4 call so
      that the ordering of inode_wait -> write lock is retained. Since this
      would have been the case before the BKL push-down, this is safe.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      a1457c0c
    • J
      reiserfs: fix problems with chowning setuid file w/ xattrs · 4a857011
      Jeff Mahoney 提交于
      reiserfs_chown_xattrs() takes the iattr struct passed into ->setattr
      and uses it to iterate over all the attrs associated with a file to change
      ownership of xattrs (and transfer quota associated with the xattr files).
      
      When the setuid bit is cleared during chown, ATTR_MODE and iattr->ia_mode
      are passed to all the xattrs as well. This means that the xattr directory
      will have S_IFREG added to its mode bits.
      
      This has been prevented in practice by a missing IS_PRIVATE check
      in reiserfs_acl_chmod, which caused a double-lock to occur while holding
      the write lock. Since the file system was completely locked up, the
      writeout of the corrupted mode never happened.
      
      This patch temporarily clears everything but ATTR_UID|ATTR_GID for the
      calls to reiserfs_setattr and adds the missing IS_PRIVATE check.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      4a857011
    • J
      reiserfs: fix spurious multiple-fill in reiserfs_readdir_dentry · 0bdc7acb
      Jeff Mahoney 提交于
      After sleeping for filldir(), we check to see if the file system has
      changed and research. The next_pos pointer is updated but its value
      isn't pushed into the key used for the search itself. As a result,
      the search returns the same item that the last cycle of the loop did
      and filldir() is called multiple times with the same data.
      
      The end result is that the buffer can contain the same name multiple
      times. This can be returned to userspace or used internally in the
      xattr code where it can manifest with the following warning:
      
      jdm-20004 reiserfs_delete_xattrs: Couldn't delete all xattrs (-2)
      
      reiserfs_for_each_xattr uses reiserfs_readdir_dentry to iterate over
      the xattr names and ends up trying to unlink the same name twice. The
      second attempt fails with -ENOENT and the error is returned. At some
      point I'll need to add support into reiserfsck to remove the orphaned
      directories left behind when this occurs.
      
      The fix is to push the value into the key before researching.
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      0bdc7acb
  14. 22 5月, 2013 2 次提交
    • L
      reiserfs: use ->invalidatepage() length argument · bad54831
      Lukas Czerner 提交于
      ->invalidatepage() aop now accepts range to invalidate so we can make
      use of it in reiserfs_invalidatepage()
      Signed-off-by: NLukas Czerner <lczerner@redhat.com>
      Cc: reiserfs-devel@vger.kernel.org
      bad54831
    • L
      mm: change invalidatepage prototype to accept length · d47992f8
      Lukas Czerner 提交于
      Currently there is no way to truncate partial page where the end
      truncate point is not at the end of the page. This is because it was not
      needed and the functionality was enough for file system truncate
      operation to work properly. However more file systems now support punch
      hole feature and it can benefit from mm supporting truncating page just
      up to the certain point.
      
      Specifically, with this functionality truncate_inode_pages_range() can
      be changed so it supports truncating partial page at the end of the
      range (currently it will BUG_ON() if 'end' is not at the end of the
      page).
      
      This commit changes the invalidatepage() address space operation
      prototype to accept range to be invalidated and update all the instances
      for it.
      
      We also change the block_invalidatepage() in the same way and actually
      make a use of the new length argument implementing range invalidation.
      
      Actual file system implementations will follow except the file systems
      where the changes are really simple and should not change the behaviour
      in any way .Implementation for truncate_page_range() which will be able
      to accept page unaligned ranges will follow as well.
      Signed-off-by: NLukas Czerner <lczerner@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Hugh Dickins <hughd@google.com>
      d47992f8
  15. 08 5月, 2013 1 次提交
  16. 07 5月, 2013 1 次提交
  17. 02 5月, 2013 2 次提交
  18. 10 4月, 2013 2 次提交
  19. 30 3月, 2013 1 次提交
  20. 12 3月, 2013 1 次提交