07 Jan, 2012

1 commit


04 Jan, 2012

1 commit


26 Jul, 2011

1 commit

  • Using __test_and_{set,clear}_bit_le() with ignoring its return value can
    be replaced with __{set,clear}_bit_le().

    This introduces reiserfs_{set,clear}_le_bit for __{set,clear}_bit_le and
    does the above change with them.

    Signed-off-by: Akinobu Mita
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Akinobu Mita
     

31 Mar, 2011

1 commit


24 Mar, 2011

1 commit

  • As a preparation for removing ext2 non-atomic bit operations from
    asm/bitops.h. This converts ext2 non-atomic bit operations to
    little-endian bit operations.

    Signed-off-by: Akinobu Mita
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Akinobu Mita
     

18 Nov, 2010

1 commit


26 Oct, 2010

1 commit

  • __block_write_begin and block_prepare_write are identical except for slightly
    different calling conventions. Convert all callers to the __block_write_begin
    calling conventions and drop block_prepare_write.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Christoph Hellwig
     

11 Aug, 2010

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (96 commits)
    no need for list_for_each_entry_safe()/resetting with superblock list
    Fix sget() race with failing mount
    vfs: don't hold s_umount over close_bdev_exclusive() call
    sysv: do not mark superblock dirty on remount
    sysv: do not mark superblock dirty on mount
    btrfs: remove junk sb_dirt change
    BFS: clean up the superblock usage
    AFFS: wait for sb synchronization when needed
    AFFS: clean up dirty flag usage
    cifs: truncate fallout
    mbcache: fix shrinker function return value
    mbcache: Remove unused features
    add f_flags to struct statfs(64)
    pass a struct path to vfs_statfs
    update VFS documentation for method changes.
    All filesystems that need invalidate_inode_buffers() are doing that explicitly
    convert remaining ->clear_inode() to ->evict_inode()
    Make ->drop_inode() just return whether inode needs to be dropped
    fs/inode.c:clear_inode() is gone
    fs/inode.c:evict() doesn't care about delete vs. non-delete paths now
    ...

    Fix up trivial conflicts in fs/nilfs2/super.c

    Linus Torvalds
     

10 Aug, 2010

1 commit


19 Jul, 2010

1 commit


06 Mar, 2010

1 commit

  • This gives the filesystem more information about the writeback that
    is happening. Trond requested this for the NFS unstable write handling,
    and other filesystems might benefit from this too by beeing able to
    distinguish between the different callers in more detail.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Christoph Hellwig
     

03 Jan, 2010

1 commit

  • …t/frederic/random-tracing

    * 'reiserfs/kill-bkl' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing:
    reiserfs: Safely acquire i_mutex from xattr_rmdir
    reiserfs: Safely acquire i_mutex from reiserfs_for_each_xattr
    reiserfs: Fix journal mutex <-> inode mutex lock inversion
    reiserfs: Fix unwanted recursive reiserfs lock in reiserfs_unlink()
    reiserfs: Relax lock before open xattr dir in reiserfs_xattr_set_handle()
    reiserfs: Relax reiserfs lock while freeing the journal
    reiserfs: Fix reiserfs lock <-> i_mutex dependency inversion on xattr
    reiserfs: Warn on lock relax if taken recursively
    reiserfs: Fix reiserfs lock <-> i_xattr_sem dependency inversion
    reiserfs: Fix remaining in-reclaim-fs <-> reclaim-fs-on locking inversion
    reiserfs: Fix reiserfs lock <-> inode mutex dependency inversion
    reiserfs: Fix reiserfs lock and journal lock inversion dependency
    reiserfs: Fix possible recursive lock

    Linus Torvalds
     

02 Jan, 2010

2 commits

  • When we relax the reiserfs lock to avoid creating unwanted
    dependencies against others locks while grabbing these,
    we want to ensure it has not been taken recursively, otherwise
    the lock won't be really relaxed. Only its depth will be decreased.
    The unwanted dependency would then actually happen.

    To prevent from that, add a reiserfs_lock_check_recursive() call
    in the places that need it.

    Signed-off-by: Frederic Weisbecker
    Cc: Alexander Beregalov
    Cc: Chris Mason
    Cc: Ingo Molnar

    Frederic Weisbecker
     
  • i_xattr_sem depends on the reiserfs lock. But after we grab
    i_xattr_sem, we may relax/relock the reiserfs lock while waiting
    on a freezed filesystem, creating a dependency inversion between
    the two locks.

    In order to avoid the i_xattr_sem -> reiserfs lock dependency, let's
    create a reiserfs_down_read_safe() that acts like
    reiserfs_mutex_lock_safe(): relax the reiserfs lock while grabbing
    another lock to avoid undesired dependencies induced by the
    heivyweight reiserfs lock.

    This fixes the following warning:

    [ 990.005931] =======================================================
    [ 990.012373] [ INFO: possible circular locking dependency detected ]
    [ 990.013233] 2.6.33-rc1 #1
    [ 990.013233] -------------------------------------------------------
    [ 990.013233] dbench/1891 is trying to acquire lock:
    [ 990.013233] (&REISERFS_SB(s)->lock){+.+.+.}, at: [] reiserfs_write_lock+0x35/0x50
    [ 990.013233]
    [ 990.013233] but task is already holding lock:
    [ 990.013233] (&REISERFS_I(inode)->i_xattr_sem){+.+.+.}, at: [] reiserfs_xattr_set_handle+0x8a/0x470
    [ 990.013233]
    [ 990.013233] which lock already depends on the new lock.
    [ 990.013233]
    [ 990.013233]
    [ 990.013233] the existing dependency chain (in reverse order) is:
    [ 990.013233]
    [ 990.013233] -> #1 (&REISERFS_I(inode)->i_xattr_sem){+.+.+.}:
    [ 990.013233] [] __lock_acquire+0xf9c/0x1560
    [ 990.013233] [] lock_acquire+0x8f/0xb0
    [ 990.013233] [] down_write+0x44/0x80
    [ 990.013233] [] reiserfs_xattr_set_handle+0x8a/0x470
    [ 990.013233] [] reiserfs_xattr_set+0xb0/0x150
    [ 990.013233] [] user_set+0x8a/0x90
    [ 990.013233] [] reiserfs_setxattr+0xaa/0xb0
    [ 990.013233] [] __vfs_setxattr_noperm+0x36/0xa0
    [ 990.013233] [] vfs_setxattr+0xbc/0xc0
    [ 990.013233] [] setxattr+0xc0/0x150
    [ 990.013233] [] sys_fsetxattr+0x8d/0xa0
    [ 990.013233] [] system_call_fastpath+0x16/0x1b
    [ 990.013233]
    [ 990.013233] -> #0 (&REISERFS_SB(s)->lock){+.+.+.}:
    [ 990.013233] [] __lock_acquire+0x12d0/0x1560
    [ 990.013233] [] lock_acquire+0x8f/0xb0
    [ 990.013233] [] __mutex_lock_common+0x47/0x3b0
    [ 990.013233] [] mutex_lock_nested+0x3e/0x50
    [ 990.013233] [] reiserfs_write_lock+0x35/0x50
    [ 990.013233] [] reiserfs_prepare_write+0x45/0x180
    [ 990.013233] [] reiserfs_xattr_set_handle+0x2a6/0x470
    [ 990.013233] [] reiserfs_xattr_set+0xb0/0x150
    [ 990.013233] [] user_set+0x8a/0x90
    [ 990.013233] [] reiserfs_setxattr+0xaa/0xb0
    [ 990.013233] [] __vfs_setxattr_noperm+0x36/0xa0
    [ 990.013233] [] vfs_setxattr+0xbc/0xc0
    [ 990.013233] [] setxattr+0xc0/0x150
    [ 990.013233] [] sys_fsetxattr+0x8d/0xa0
    [ 990.013233] [] system_call_fastpath+0x16/0x1b
    [ 990.013233]
    [ 990.013233] other info that might help us debug this:
    [ 990.013233]
    [ 990.013233] 2 locks held by dbench/1891:
    [ 990.013233] #0: (&sb->s_type->i_mutex_key#12){+.+.+.}, at: [] vfs_setxattr+0x78/0xc0
    [ 990.013233] #1: (&REISERFS_I(inode)->i_xattr_sem){+.+.+.}, at: [] reiserfs_xattr_set_handle+0x8a/0x470
    [ 990.013233]
    [ 990.013233] stack backtrace:
    [ 990.013233] Pid: 1891, comm: dbench Not tainted 2.6.33-rc1 #1
    [ 990.013233] Call Trace:
    [ 990.013233] [] print_circular_bug+0xe9/0xf0
    [ 990.013233] [] __lock_acquire+0x12d0/0x1560
    [ 990.013233] [] ? reiserfs_xattr_set_handle+0x8a/0x470
    [ 990.013233] [] lock_acquire+0x8f/0xb0
    [ 990.013233] [] ? reiserfs_write_lock+0x35/0x50
    [ 990.013233] [] ? reiserfs_xattr_set_handle+0x8a/0x470
    [ 990.013233] [] __mutex_lock_common+0x47/0x3b0
    [ 990.013233] [] ? reiserfs_write_lock+0x35/0x50
    [ 990.013233] [] ? reiserfs_write_lock+0x35/0x50
    [ 990.013233] [] ? mark_held_locks+0x72/0xa0
    [ 990.013233] [] ? __mutex_unlock_slowpath+0xbd/0x140
    [ 990.013233] [] ? trace_hardirqs_on_caller+0x14d/0x1a0
    [ 990.013233] [] mutex_lock_nested+0x3e/0x50
    [ 990.013233] [] reiserfs_write_lock+0x35/0x50
    [ 990.013233] [] reiserfs_prepare_write+0x45/0x180
    [ 990.013233] [] reiserfs_xattr_set_handle+0x2a6/0x470
    [ 990.013233] [] reiserfs_xattr_set+0xb0/0x150
    [ 990.013233] [] ? __mutex_lock_common+0x284/0x3b0
    [ 990.013233] [] user_set+0x8a/0x90
    [ 990.013233] [] reiserfs_setxattr+0xaa/0xb0
    [ 990.013233] [] __vfs_setxattr_noperm+0x36/0xa0
    [ 990.013233] [] vfs_setxattr+0xbc/0xc0
    [ 990.013233] [] setxattr+0xc0/0x150
    [ 990.013233] [] ? sched_clock_cpu+0xb8/0x100
    [ 990.013233] [] ? trace_hardirqs_off+0xd/0x10
    [ 990.013233] [] ? cpu_clock+0x43/0x50
    [ 990.013233] [] ? fget+0xb0/0x110
    [ 990.013233] [] ? fget+0x0/0x110
    [ 990.013233] [] ? sysret_check+0x27/0x62
    [ 990.013233] [] sys_fsetxattr+0x8d/0xa0
    [ 990.013233] [] system_call_fastpath+0x16/0x1b

    Reported-and-tested-by: Christian Kujau
    Signed-off-by: Frederic Weisbecker
    Cc: Alexander Beregalov
    Cc: Chris Mason
    Cc: Ingo Molnar

    Frederic Weisbecker
     

17 Dec, 2009

1 commit

  • The reiserfs lock -> inode mutex dependency gets inverted when we
    relax the lock while walking to the tree.

    To fix this, use a specialized version of reiserfs_mutex_lock_safe
    that takes care of mutex subclasses. Then we can grab the inode
    mutex with I_MUTEX_XATTR subclass without any reiserfs lock
    dependency.

    This fixes the following report:

    [ INFO: possible circular locking dependency detected ]
    2.6.32-06793-gf405425-dirty #2
    -------------------------------------------------------
    mv/18566 is trying to acquire lock:
    (&REISERFS_SB(s)->lock){+.+.+.}, at: [] reiserfs_write_lock+0x28=
    /0x40

    but task is already holding lock:
    (&sb->s_type->i_mutex_key#5/3){+.+.+.}, at: []
    reiserfs_for_each_xattr+0x10c/0x380

    which lock already depends on the new lock.

    the existing dependency chain (in reverse order) is:

    -> #1 (&sb->s_type->i_mutex_key#5/3){+.+.+.}:
    [] validate_chain+0xa23/0xf70
    [] __lock_acquire+0x4e5/0xa70
    [] lock_acquire+0x7a/0xa0
    [] mutex_lock_nested+0x5f/0x2b0
    [] reiserfs_for_each_xattr+0x84/0x380
    [] reiserfs_delete_xattrs+0x15/0x50
    [] reiserfs_delete_inode+0x8f/0x140
    [] generic_delete_inode+0x9c/0x150
    [] generic_drop_inode+0x3d/0x60
    [] iput+0x47/0x50
    [] do_unlinkat+0xdb/0x160
    [] sys_unlink+0x10/0x20
    [] sysenter_do_call+0x12/0x36

    -> #0 (&REISERFS_SB(s)->lock){+.+.+.}:
    [] validate_chain+0xf68/0xf70
    [] __lock_acquire+0x4e5/0xa70
    [] lock_acquire+0x7a/0xa0
    [] mutex_lock_nested+0x5f/0x2b0
    [] reiserfs_write_lock+0x28/0x40
    [] search_by_key+0x1f7b/0x21b0
    [] search_by_entry_key+0x1f/0x3b0
    [] reiserfs_find_entry+0x77/0x400
    [] reiserfs_lookup+0x85/0x130
    [] __lookup_hash+0xb4/0x110
    [] lookup_one_len+0xb3/0x100
    [] reiserfs_for_each_xattr+0x120/0x380
    [] reiserfs_delete_xattrs+0x15/0x50
    [] reiserfs_delete_inode+0x8f/0x140
    [] generic_delete_inode+0x9c/0x150
    [] generic_drop_inode+0x3d/0x60
    [] iput+0x47/0x50
    [] dentry_iput+0x6f/0xf0
    [] d_kill+0x24/0x50
    [] dput+0x5b/0x120
    [] sys_renameat+0x1b9/0x230
    [] sys_rename+0x28/0x30
    [] sysenter_do_call+0x12/0x36

    other info that might help us debug this:

    2 locks held by mv/18566:
    #0: (&sb->s_type->i_mutex_key#5/1){+.+.+.}, at: []
    lock_rename+0xcc/0xd0
    #1: (&sb->s_type->i_mutex_key#5/3){+.+.+.}, at: []
    reiserfs_for_each_xattr+0x10c/0x380

    stack backtrace:
    Pid: 18566, comm: mv Tainted: G C 2.6.32-06793-gf405425-dirty #2
    Call Trace:
    [] ? printk+0x18/0x1e
    [] print_circular_bug+0xc0/0xd0
    [] validate_chain+0xf68/0xf70
    [] ? trace_hardirqs_off+0xb/0x10
    [] __lock_acquire+0x4e5/0xa70
    [] lock_acquire+0x7a/0xa0
    [] ? reiserfs_write_lock+0x28/0x40
    [] mutex_lock_nested+0x5f/0x2b0
    [] ? reiserfs_write_lock+0x28/0x40
    [] ? reiserfs_write_lock+0x28/0x40
    [] ? schedule+0x27a/0x440
    [] reiserfs_write_lock+0x28/0x40
    [] search_by_key+0x1f7b/0x21b0
    [] ? __lock_acquire+0x506/0xa70
    [] ? lock_release_non_nested+0x1e7/0x340
    [] ? reiserfs_write_lock+0x28/0x40
    [] ? trace_hardirqs_on_caller+0x124/0x170
    [] ? trace_hardirqs_on+0xb/0x10
    [] ? T.316+0x15/0x1a0
    [] ? sched_clock_cpu+0x9d/0x100
    [] search_by_entry_key+0x1f/0x3b0
    [] ? __mutex_unlock_slowpath+0x9a/0x120
    [] ? trace_hardirqs_on_caller+0x124/0x170
    [] reiserfs_find_entry+0x77/0x400
    [] reiserfs_lookup+0x85/0x130
    [] ? sched_clock_cpu+0x9d/0x100
    [] __lookup_hash+0xb4/0x110
    [] lookup_one_len+0xb3/0x100
    [] reiserfs_for_each_xattr+0x120/0x380
    [] ? delete_one_xattr+0x0/0x1c0
    [] ? math_error+0x22/0x150
    [] ? reiserfs_write_lock+0x28/0x40
    [] reiserfs_delete_xattrs+0x15/0x50
    [] ? reiserfs_write_lock+0x28/0x40
    [] reiserfs_delete_inode+0x8f/0x140
    [] ? generic_delete_inode+0x5f/0x150
    [] ? reiserfs_delete_inode+0x0/0x140
    [] generic_delete_inode+0x9c/0x150
    [] generic_drop_inode+0x3d/0x60
    [] iput+0x47/0x50
    [] dentry_iput+0x6f/0xf0
    [] d_kill+0x24/0x50
    [] dput+0x5b/0x120
    [] sys_renameat+0x1b9/0x230
    [] ? sched_clock_cpu+0x9d/0x100
    [] ? trace_hardirqs_off+0xb/0x10
    [] ? cpu_clock+0x4e/0x60
    [] ? do_page_fault+0x155/0x370
    [] ? up_read+0x16/0x30
    [] ? do_page_fault+0x155/0x370
    [] sys_rename+0x28/0x30
    [] sysenter_do_call+0x12/0x36

    Reported-by: Alexander Beregalov
    Signed-off-by: Frederic Weisbecker
    Cc: Chris Mason
    Cc: Ingo Molnar
    Cc: Thomas Gleixner

    Frederic Weisbecker
     

16 Dec, 2009

2 commits


15 Oct, 2009

1 commit


14 Sep, 2009

6 commits

  • While searching a pathname, an inode mutex can be acquired
    in do_lookup() which calls reiserfs_lookup() which in turn
    acquires the write lock.

    On the other side reiserfs_fill_super() can acquire the write_lock
    and then call reiserfs_lookup_privroot() which can acquire an
    inode mutex (the root of the mount point).

    So we theoretically risk an AB - BA lock inversion that could lead
    to a deadlock.

    As for other lock dependencies found since the bkl to mutex
    conversion, the fix is to use reiserfs_mutex_lock_safe() which
    drops the lock dependency to the write lock.

    [ Impact: fix a possible deadlock with reiserfs ]

    Cc: Jeff Mahoney
    Cc: Chris Mason
    Cc: Ingo Molnar
    Cc: Alexander Beregalov
    Signed-off-by: Frederic Weisbecker

    Frederic Weisbecker
     
  • The goal of fs_changed() is to check whether the tree changed during a
    schedule(). This is a BKL legacy.

    A recent patch added an explicit unconditional release/reacquire of the
    write lock around the cond_resched() called inside fs_changed.

    But it's wasteful to unconditionally do that, we are creating superfluous
    lock contention in !TIF_NEED_RESCHED case.

    This patch manage that by calling reiserfs_cond_resched() from fs_changed()
    which only releases the lock if we are going to reschedule.

    [ Impact: inject less lock contention and tree job retries ]

    Cc: Jeff Mahoney
    Cc: Chris Mason
    Cc: Ingo Molnar
    Cc: Alexander Beregalov
    Signed-off-by: Frederic Weisbecker

    Frederic Weisbecker
     
  • Usually, when we call cond_resched(), we want the write lock
    to be released and then reacquired once we return from scheduling.
    Not only does it follow the previous bkl based locking scheme, but
    it also let other waiters to get the lock.

    But if we aren't going to reschedule(), such as in !TIF_NEED_RESCHED
    case, it's useless to release the lock. Worse, if we release and reacquire
    the lock whereas it is not needed, we create useless contentions. Also
    if someone takes the lock while we are modifying or reading the tree,
    there are good chances we'll have to retry our operation, eg if the
    block we were seeeking has moved.

    So this patch introduces a helper which only unlock the write lock
    if we are going to schedule.

    [ Impact: prepare to inject less lock contention and less tree operation attempts ]

    Reported-by: Andi Kleen
    Cc: Jeff Mahoney
    Cc: Chris Mason
    Cc: Ingo Molnar
    Cc: Alexander Beregalov
    Signed-off-by: Frederic Weisbecker

    Frederic Weisbecker
     
  • fs_changed() is a macro used by reiserfs to check whether its tree has been
    rebalanced. It has been designed to check parallel changes on the tree after
    calling a sleeping function, which released the Bkl.

    fs_changed() also calls cond_resched(), so that if rescheduling is needed,
    we are in the best place to do that, since we check if the tree has changed
    just after (because of the bkl release on schedule()).

    Even if we are not anymore using the Bkl, we still want to release the lock
    while we reschedule, so that other waiters for the lock can acquire it safely,
    because of the following __fs_changed() check.

    [ Impact: release the reiserfs write lock when it is not needed ]

    Cc: Jeff Mahoney
    Cc: Chris Mason
    Cc: Alexander Beregalov
    Signed-off-by: Frederic Weisbecker

    Frederic Weisbecker
     
  • Sometimes we don't want to recursively hold the per superblock write
    lock because we want to be sure it is actually released when we come
    to sleep.

    This patch introduces the necessary tools for that.

    reiserfs_write_lock_once() does the same job than reiserfs_write_lock()
    except that it won't try to acquire recursively the lock if the current
    task already owns it. Also the lock_depth before the call of this function
    is returned.

    reiserfs_write_unlock_once() unlock only if reiserfs_write_lock_once()
    returned a depth equal to -1, ie: only if it actually locked.

    Signed-off-by: Frederic Weisbecker
    Cc: Alessio Igor Bogani
    Cc: Jeff Mahoney
    Cc: Alexander Beregalov
    Cc: Chris Mason
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     
  • This patch is an attempt to remove the Bkl based locking scheme from
    reiserfs and is intended.

    It is a bit inspired from an old attempt by Peter Zijlstra:

    http://lkml.indiana.edu/hypermail/linux/kernel/0704.2/2174.html

    The bkl is heavily used in this filesystem to prevent from
    concurrent write accesses on the filesystem.

    Reiserfs makes a deep use of the specific properties of the Bkl:

    - It can be acqquired recursively by a same task
    - It is released on the schedule() calls and reacquired when schedule() returns

    The two properties above are a roadmap for the reiserfs write locking so it's
    very hard to simply replace it with a common mutex.

    - We need a recursive-able locking unless we want to restructure several blocks
    of the code.
    - We need to identify the sites where the bkl was implictly relaxed
    (schedule, wait, sync, etc...) so that we can in turn release and
    reacquire our new lock explicitly.
    Such implicit releases of the lock are often required to let other
    resources producer/consumer do their job or we can suffer unexpected
    starvations or deadlocks.

    So the new lock that replaces the bkl here is a per superblock mutex with a
    specific property: it can be acquired recursively by a same task, like the
    bkl.

    For such purpose, we integrate a lock owner and a lock depth field on the
    superblock information structure.

    The first axis on this patch is to turn reiserfs_write_(un)lock() function
    into a wrapper to manage this mutex. Also some explicit calls to
    lock_kernel() have been converted to reiserfs_write_lock() helpers.

    The second axis is to find the important blocking sites (schedule...(),
    wait_on_buffer(), sync_dirty_buffer(), etc...) and then apply an explicit
    release of the write lock on these locations before blocking. Then we can
    safely wait for those who can give us resources or those who need some.
    Typically this is a fight between the current writer, the reiserfs workqueue
    (aka the async commiter) and the pdflush threads.

    The third axis is a consequence of the second. The write lock is usually
    on top of a lock dependency chain which can include the journal lock, the
    flush lock or the commit lock. So it's dangerous to release and trying to
    reacquire the write lock while we still hold other locks.

    This is fine with the bkl:

    T1 T2

    lock_kernel()
    mutex_lock(A)
    unlock_kernel()
    // do something
    lock_kernel()
    mutex_lock(A) -> already locked by T1
    schedule() (and then unlock_kernel())
    lock_kernel()
    mutex_unlock(A)
    ....

    This is not fine with a mutex:

    T1 T2

    mutex_lock(write)
    mutex_lock(A)
    mutex_unlock(write)
    // do something
    mutex_lock(write)
    mutex_lock(A) -> already locked by T1
    schedule()

    mutex_lock(write) -> already locked by T2
    deadlock

    The solution in this patch is to provide a helper which releases the write
    lock and sleep a bit if we can't lock a mutex that depend on it. It's another
    simulation of the bkl behaviour.

    The last axis is to locate the fs callbacks that are called with the bkl held,
    according to Documentation/filesystem/Locking.

    Those are:

    - reiserfs_remount
    - reiserfs_fill_super
    - reiserfs_put_super

    Reiserfs didn't need to explicitly lock because of the context of these callbacks.
    But now we must take care of that with the new locking.

    After this patch, reiserfs suffers from a slight performance regression (for now).
    On UP, a high volume write with dd reports an average of 27 MB/s instead
    of 30 MB/s without the patch applied.

    Signed-off-by: Frederic Weisbecker
    Reviewed-by: Ingo Molnar
    Cc: Jeff Mahoney
    Cc: Peter Zijlstra
    Cc: Bron Gondwana
    Cc: Andrew Morton
    Cc: Linus Torvalds
    Cc: Alexander Viro
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     

19 Jun, 2009

1 commit

  • Several code paths in reiserfs have a construct like:

    if (is_direntry_le_ih(ih = B_N_PITEM_HEAD(src, item_num))) ...

    which, in addition to being ugly, end up causing compiler warnings with
    gcc 4.4.0. Previous compilers didn't issue a warning.

    fs/reiserfs/do_balan.c:1273: warning: operation on `aux_ih' may be undefined
    fs/reiserfs/lbalance.c:393: warning: operation on `ih' may be undefined
    fs/reiserfs/lbalance.c:421: warning: operation on `ih' may be undefined
    fs/reiserfs/lbalance.c:777: warning: operation on `ih' may be undefined

    I believe this is due to the ih being passed to macros which evaluate the
    argument more than once. This is old code and we haven't seen any
    problems with it, but this patch eliminates the warnings.

    It converts the multiple evaluation macros to static inlines and does a
    preassignment for the cases that were causing the warnings because that
    code is just ugly.

    Reported-by: Chris Mason
    Signed-off-by: Jeff Mahoney
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     

31 Mar, 2009

15 commits

  • * reiserfs-updates: (35 commits)
    reiserfs: rename [cn]_* variables
    reiserfs: rename p_._ variables
    reiserfs: rename p_s_tb to tb
    reiserfs: rename p_s_inode to inode
    reiserfs: rename p_s_bh to bh
    reiserfs: rename p_s_sb to sb
    reiserfs: strip trailing whitespace
    reiserfs: cleanup path functions
    reiserfs: factor out buffer_info initialization
    reiserfs: add atomic addition of selinux attributes during inode creation
    reiserfs: use generic readdir for operations across all xattrs
    reiserfs: journaled xattrs
    reiserfs: use generic xattr handlers
    reiserfs: remove i_has_xattr_dir
    reiserfs: make per-inode xattr locking more fine grained
    reiserfs: eliminate per-super xattr lock
    reiserfs: simplify xattr internal file lookups/opens
    reiserfs: Clean up xattrs when REISERFS_FS_XATTR is unset
    reiserfs: remove IS_PRIVATE helpers
    reiserfs: remove link detection code
    ...

    Fixed up conflicts manually due to:
    - quota name cleanups vs variable naming changes:
    fs/reiserfs/inode.c
    fs/reiserfs/namei.c
    fs/reiserfs/stree.c
    fs/reiserfs/xattr.c
    - exported include header cleanups
    include/linux/reiserfs_fs.h

    Linus Torvalds
     
  • This patch is a simple s/p_._//g to the reiserfs code. This is the
    fifth in a series of patches to rip out some of the awful variable
    naming in reiserfs.

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     
  • This patch is a simple s/p_s_tb/tb/g to the reiserfs code. This is the
    fourth in a series of patches to rip out some of the awful variable
    naming in reiserfs.

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     
  • This patch is a simple s/p_s_inode/inode/g to the reiserfs code. This
    is the third in a series of patches to rip out some of the awful
    variable naming in reiserfs.

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     
  • This patch is a simple s/p_s_bh/bh/g to the reiserfs code. This is the
    second in a series of patches to rip out some of the awful variable
    naming in reiserfs.

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     
  • This patch is a simple s/p_s_sb/sb/g to the reiserfs code. This is the
    first in a series of patches to rip out some of the awful variable
    naming in reiserfs.

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     
  • Some time ago, some changes were made to make security inode attributes
    be atomically written during inode creation. ReiserFS fell behind in
    this area, but with the reworking of the xattr code, it's now fairly
    easy to add.

    The following patch adds the ability for security attributes to be added
    automatically during inode creation.

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     
  • The current reiserfs xattr implementation open codes reiserfs_readdir
    and frees the path before calling the filldir function. Typically, the
    filldir function is something that modifies the file system, such as a
    chown or an inode deletion that also require reading of an inode
    associated with each direntry. Since the file system is modified, the
    path retained becomes invalid for the next run. In addition, it runs
    backwards in attempt to minimize activity.

    This is clearly suboptimal from a code cleanliness perspective as well
    as performance-wise.

    This patch implements a generic reiserfs_for_each_xattr that uses the
    generic readdir and a specific filldir routine that simply populates an
    array of dentries and then performs a specific operation on them. When
    all files have been operated on, it then calls the operation on the
    directory itself.

    The result is a noticable code reduction and better performance.

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     
  • Deadlocks are possible in the xattr code between the journal lock and the
    xattr sems.

    This patch implements journalling for xattr operations. The benefit is
    twofold:
    * It gets rid of the deadlock possibility by always ensuring that xattr
    write operations are initiated inside a transaction.
    * It corrects the problem where xattr backing files aren't considered any
    differently than normal files, despite the fact they are metadata.

    I discussed the added journal load with Chris Mason, and we decided that
    since xattrs (versus other journal activity) is fairly rare, the introduction
    of larger transactions to support journaled xattrs wouldn't be too big a deal.

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     
  • With the switch to using inode->i_mutex locking during lookups/creation
    in the xattr root, the per-super xattr lock is no longer needed.

    This patch removes it.

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     
  • Although reiserfs can currently handle severe errors such as journal failure,
    it cannot handle less severe errors like metadata i/o failure. The following
    patch adds a reiserfs_error() function akin to the one in ext3.

    Subsequent patches will use this new error handler to handle errors more
    gracefully in general.

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     
  • This patch kills off reiserfs_journal_abort as it is never called, and
    combines __reiserfs_journal_abort_{soft,hard} into one function called
    reiserfs_abort_journal, which performs the same work. It is silent
    as opposed to the old version, since the message was always issued
    after a regular 'abort' message.

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     
  • ReiserFS panics can be somewhat inconsistent.
    In some cases:
    * a unique identifier may be associated with it
    * the function name may be included
    * the device may be printed separately

    This patch aims to make warnings more consistent. reiserfs_warning() prints
    the device name, so printing it a second time is not required. The function
    name for a warning is always helpful in debugging, so it is now automatically
    inserted into the output. Hans has stated that every warning should have
    a unique identifier. Some cases lack them, others really shouldn't have them.
    reiserfs_warning() now expects an id associated with each message. In the
    rare case where one isn't needed, "" will suffice.

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     
  • uniqueness2type and type2uniquness issue a warning when the value is
    unknown. When called from reiserfs_warning, this causes a re-entrancy
    problem and deadlocks on the error buffer lock.

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Linus Torvalds

    Jeff Mahoney
     
  • ReiserFS warnings can be somewhat inconsistent.
    In some cases:
    * a unique identifier may be associated with it
    * the function name may be included
    * the device may be printed separately

    This patch aims to make warnings more consistent. reiserfs_warning() prints
    the device name, so printing it a second time is not required. The function
    name for a warning is always helpful in debugging, so it is now automatically
    inserted into the output. Hans has stated that every warning should have
    a unique identifier. Some cases lack them, others really shouldn't have them.
    reiserfs_warning() now expects an id associated with each message. In the
    rare case where one isn't needed, "" will suffice.

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Linus Torvalds

    Jeff Mahoney