07 Jan, 2012

1 commit


04 Jan, 2012

1 commit

  • Move invalidate_bdev, block_sync_page into fs/block_dev.c. Export
    kill_bdev as well, so brd doesn't have to open code it. Reduce
    buffer_head.h requirement accordingly.

    Removed a rather large comment from invalidate_bdev, as it looked a bit
    obsolete to bother moving. The small comment replacing it says enough.

    Signed-off-by: Nick Piggin
    Cc: Al Viro
    Cc: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Al Viro

    Al Viro
     

25 May, 2011

1 commit

  • Change each shrinker's API by consolidating the existing parameters into
    shrink_control struct. This will simplify any further features added w/o
    touching each file of shrinker.

    [akpm@linux-foundation.org: fix build]
    [akpm@linux-foundation.org: fix warning]
    [kosaki.motohiro@jp.fujitsu.com: fix up new shrinker API]
    [akpm@linux-foundation.org: fix xfs warning]
    [akpm@linux-foundation.org: update gfs2]
    Signed-off-by: Ying Han
    Cc: KOSAKI Motohiro
    Cc: Minchan Kim
    Acked-by: Pavel Emelyanov
    Cc: KAMEZAWA Hiroyuki
    Cc: Mel Gorman
    Acked-by: Rik van Riel
    Cc: Johannes Weiner
    Cc: Hugh Dickins
    Cc: Dave Hansen
    Cc: Steven Whitehouse
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ying Han
     

08 Apr, 2011

1 commit


01 Apr, 2011

1 commit

  • There's no reason to write quota info in dquot_commit(). The writing is a
    relict from the old days when we didn't have dquot_acquire() and
    dquot_release() and thus dquot_commit() could have created / removed quota
    structures from the file. These days dquot_commit() only updates usage counters
    / limits in quota structure and thus there's no need to write quota info.

    This also fixes an issue with journaling filesystem which didn't reserve
    enough space in the transaction for write of quota info (it could have been
    dirty at the time of dquot_commit() because of a race with other operation
    changing it).

    CC: stable@kernel.org
    Reported-and-tested-by: Lukas Czerner
    Signed-off-by: Jan Kara

    Jan Kara
     

31 Mar, 2011

1 commit


25 Mar, 2011

2 commits

  • Protect the per-sb inode list with a new global lock
    inode_sb_list_lock and use it to protect the list manipulations and
    traversals. This lock replaces the inode_lock as the inodes on the
    list can be validity checked while holding the inode->i_lock and
    hence the inode_lock is no longer needed to protect the list.

    Signed-off-by: Dave Chinner
    Signed-off-by: Al Viro

    Dave Chinner
     
  • Protect inode state transitions and validity checks with the
    inode->i_lock. This enables us to make inode state transitions
    independently of the inode_lock and is the first step to peeling
    away the inode_lock from the code.

    This requires that __iget() is done atomically with i_state checks
    during list traversals so that we don't race with another thread
    marking the inode I_FREEING between the state check and grabbing the
    reference.

    Also remove the unlock_new_inode() memory barrier optimisation
    required to avoid taking the inode_lock when clearing I_NEW.
    Simplify the code by simply taking the inode->i_lock around the
    state change and wakeup. Because the wakeup is no longer tricky,
    remove the wake_up_inode() function and open code the wakeup where
    necessary.

    Signed-off-by: Dave Chinner
    Signed-off-by: Al Viro

    Dave Chinner
     

13 Jan, 2011

1 commit

  • As Al Viro pointed out path resolution during Q_QUOTAON calls to quotactl
    is prone to deadlocks. We hold s_umount semaphore for reading during the
    path resolution and resolution itself may need to acquire the semaphore
    for writing when e. g. autofs mountpoint is passed.

    Solve the problem by performing the resolution before we get hold of the
    superblock (and thus s_umount semaphore). The whole thing is complicated
    by the fact that some filesystems (OCFS2) ignore the path argument. So to
    distinguish between filesystem which want the path and which do not we
    introduce new .quota_on_meta callback which does not get the path. OCFS2
    then uses this callback instead of old .quota_on.

    CC: Al Viro
    CC: Christoph Hellwig
    CC: Ted Ts'o
    CC: Joel Becker
    Signed-off-by: Jan Kara

    Jan Kara
     

11 Jan, 2011

1 commit


28 Oct, 2010

3 commits

  • When quotaon(8) races with __dquot_initialize() or dqget() fails because
    of EIO, ENOSPC, or similar error, we could possibly dereference NULL pointer
    in inode->i_dquot[cnt]. Add proper checking.

    Reported-by: Dmitry Monakhov
    Signed-off-by: Jan Kara

    Jan Kara
     
  • __dquot_transfer accidentally called flush_warnings for a wrong set of
    dquots which could result in quota warnings being issued with a wrong
    identification. Also when operation fails because of EDQUOT, there's no
    need check for issuing information message about user getting below limits
    (no transfer has actually happened).

    Signed-off-by: Jan Kara

    Jan Kara
     
  • I've got following lockup:
    dquot_disable dquot_transfer
    ->dqget()
    sb_has_quota_active
    dqopt->flags &= ~dquot_state_flag(f, cnt) atomic_inc(dq->dq_count)
    ->drop_dquot_ref(sb, cnt);
    down_write(dqptr_sem)
    inode->i_dquot[cnt] = NULL ->__dquot_transfer
    invalidate_dquots(sb, cnt); down_write(&dqptr_sem)
    ->wait for dq_wait_unused inode->i_dquot = new_dquot
    /* wait forever */ ^^^^New quota user^^^^^^

    We cannot allow new references to dquots from inodes after drop_dquot_ref()
    has removed them. We have to recheck quota state under dqptr_sem and before
    assignment, as we do it in dquot_initialize().

    Signed-off-by: Dmitry Monakhov
    Signed-off-by: Jan Kara

    Dmitry
     

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

  • add I_CLEAR instead of replacing I_FREEING with it. I_CLEAR is
    equivalent to I_FREEING for almost all code looking at either;
    it's there to keep track of having called clear_inode() exactly
    once per inode lifetime, at some point after having set I_FREEING.
    I_CLEAR and I_FREEING never get set at the same time with the
    current code, so we can switch to setting i_flags to I_FREEING | I_CLEAR
    instead of I_CLEAR without loss of information. As the result of
    such change, checks become simpler and the amount of code that needs
    to know about I_CLEAR shrinks a lot.

    Signed-off-by: Al Viro

    Al Viro
     

08 Aug, 2010

1 commit

  • * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6:
    ext3: Fix dirtying of journalled buffers in data=journal mode
    ext3: default to ordered mode
    quota: Use mark_inode_dirty_sync instead of mark_inode_dirty
    quota: Change quota error message to print out disk and function name
    MAINTAINERS: Update entries of ext2 and ext3
    MAINTAINERS: Update address of Andreas Dilger
    ext3: Avoid filesystem corruption after a crash under heavy delete load
    ext3: remove vestiges of nobh support
    ext3: Fix set but unused variables
    quota: clean up quota active checks
    quota: Clean up the namespace in dqblk_xfs.h
    quota: check quota reservation on remove_dquot_ref

    Linus Torvalds
     

23 Jul, 2010

1 commit


21 Jul, 2010

4 commits

  • The current quota error message doesn't always print the disk name, so
    it is hard to identify the "bad" disk when quota error happens.

    This patch changes the standardized quota error message to print out disk name
    and function name. It also uses a combination of cpp macro and inline function
    to provide better type checking and to lower the text size of the message.

    [Jan Kara: Export __quota_error]

    Signed-off-by: Jiaying Zhang
    Signed-off-by: Jan Kara

    Jiaying Zhang
     
  • The various quota operations check for any quota beeing active on
    a superblock, and the inode not having the noquota flag.

    Merge these two checks into a dquot_active check and move that
    into dquot.c as that's the only place where it's needed.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jan Kara

    Christoph Hellwig
     
  • Almost all identifiers use the FS_* namespace, so rename the missing few
    XFS_* ones to FS_* as well. Without this some people might get upset
    about having too many XFS names in generic code.

    Acked-by: Steven Whitehouse
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jan Kara

    Christoph Hellwig
     
  • Reserved space must being claimed before remove_dquot_ref() for a
    given inode. Filesystem is responsible for performing force blocks
    allocation in case of dealloc in ->quota_off. Let's add sanity check
    for that case. Do it similar to add_dquot_ref().

    Signed-off-by: Dmitry Monakhov
    Signed-off-by: Jan Kara

    Dmitry Monakhov
     

19 Jul, 2010

1 commit

  • The current shrinker implementation requires the registered callback
    to have global state to work from. This makes it difficult to shrink
    caches that are not global (e.g. per-filesystem caches). Pass the shrinker
    structure to the callback so that users can embed the shrinker structure
    in the context the shrinker needs to operate on and get back to it in the
    callback via container_of().

    Signed-off-by: Dave Chinner
    Reviewed-by: Christoph Hellwig

    Dave Chinner
     

31 May, 2010

1 commit

  • * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6:
    quota: Convert quota statistics to generic percpu_counter
    ext3 uses rb_node = NULL; to zero rb_root.
    quota: Fixup dquot_transfer
    reiserfs: Fix resuming of quotas on remount read-write
    pohmelfs: Remove dead quota code
    ufs: Remove dead quota code
    udf: Remove dead quota code
    quota: rename default quotactl methods to dquot_
    quota: explicitly set ->dq_op and ->s_qcop
    quota: drop remount argument to ->quota_on and ->quota_off
    quota: move unmount handling into the filesystem
    quota: kill the vfs_dq_off and vfs_dq_quota_on_remount wrappers
    quota: move remount handling into the filesystem
    ocfs2: Fix use after free on remount read-only

    Fix up conflicts in fs/ext4/super.c and fs/ufs/file.c

    Linus Torvalds
     

28 May, 2010

2 commits

  • * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (40 commits)
    ext4: Make fsync sync new parent directories in no-journal mode
    ext4: Drop whitespace at end of lines
    ext4: Fix compat EXT4_IOC_ADD_GROUP
    ext4: Conditionally define compat ioctl numbers
    tracing: Convert more ext4 events to DEFINE_EVENT
    ext4: Add new tracepoints to track mballoc's buddy bitmap loads
    ext4: Add a missing trace hook
    ext4: restart ext4_ext_remove_space() after transaction restart
    ext4: Clear the EXT4_EOFBLOCKS_FL flag only when warranted
    ext4: Avoid crashing on NULL ptr dereference on a filesystem error
    ext4: Use bitops to read/modify i_flags in struct ext4_inode_info
    ext4: Convert calls of ext4_error() to EXT4_ERROR_INODE()
    ext4: Convert callers of ext4_get_blocks() to use ext4_map_blocks()
    ext4: Add new abstraction ext4_map_blocks() underneath ext4_get_blocks()
    ext4: Use our own write_cache_pages()
    ext4: Show journal_checksum option
    ext4: Fix for ext4_mb_collect_stats()
    ext4: check for a good block group before loading buddy pages
    ext4: Prevent creation of files larger than RLIMIT_FSIZE using fallocate
    ext4: Remove extraneous newlines in ext4_msg() calls
    ...

    Fixed up trivial conflict in fs/ext4/fsync.c

    Linus Torvalds
     
  • Generic per-cpu counter has some memory overhead but it is negligible for
    modern systems and embedded systems compile without quota support. And code
    reuse is a good thing. This patch should fix complain from preemptive kernels
    which was introduced by dde9588853b1bde.

    [Jan Kara: Fixed patch to work on 32-bit archs as well]

    Reported-by: Rafael J. Wysocki
    Signed-off-by: Dmitry Monakhov
    Signed-off-by: Jan Kara

    Dmitry Monakhov
     

27 May, 2010

1 commit


24 May, 2010

4 commits


22 May, 2010

7 commits

  • Currently, __dquot_transfer() acquires its own references of dquot structures
    that will be put into inode. But for OCFS2, this creates a lock inversion
    between dq_lock (waited on in dqget) and transaction start (started in
    ocfs2_setattr). Currently, deadlock is impossible because dq_lock is acquired
    only during dquot_acquire and dquot_release and we already hold a reference to
    dquot structures in ocfs2_setattr so neither of these functions can be called
    while we call dquot_transfer. But this is rather subtle and it is hard to teach
    lockdep about it. So provide __dquot_transfer function that can be passed dquot
    references directly. OCFS2 can then pass acquired dquot references directly to
    __dquot_transfer with proper locking.

    Signed-off-by: Jan Kara

    Jan Kara
     
  • Quota must being initialized if size or uid/git changes requested.
    But initialization performed in two different places:
    in case of i_size file system is responsible for dquot init
    , but in case of uid/gid init will be called internally in
    dquot_transfer().
    This ambiguity makes code harder to understand.
    Let's move this logic to one common helper function.

    Signed-off-by: Dmitry Monakhov
    Signed-off-by: Jan Kara

    Dmitry Monakhov
     
  • Pass the larger struct fs_disk_quota to the ->set_dqblk operation so
    that the Q_SETQUOTA and Q_XSETQUOTA operations can be implemented
    with a single filesystem operation and we can retire the ->set_xquota
    operation. The additional information (RT-subvolume accounting and
    warn counts) are left zero for the VFS quota implementation.

    Add new fieldmask values for setting the numer of blocks and inodes
    values which is required for the VFS quota, but wasn't for XFS.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jan Kara

    Christoph Hellwig
     
  • Pass the larger struct fs_disk_quota to the ->get_dqblk operation so
    that the Q_GETQUOTA and Q_XGETQUOTA operations can be implemented
    with a single filesystem operation and we can retire the ->get_xquota
    operation. The additional information (RT-subvolume accounting and
    warn counts) are left zero for the VFS quota implementation.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jan Kara

    Christoph Hellwig
     
  • Quota stats is mostly writable data structure. Let's alloc percpu
    bucket for each value.

    NOTE: dqstats_read() function is racy against dqstats_{inc,dec}
    and may return inconsistent value. But this is ok since absolute
    accuracy is not required.

    Signed-off-by: Dmitry Monakhov
    Signed-off-by: Jan Kara

    Dmitry Monakhov
     
  • Suppress compilation warning: "quotatypes" defined but not used.
    quotatypes is used only when CONFIG_QUOTA_DEBUG or CONFIG_PRINT_QUOTA_WARNING
    is/are defined.

    Signed-off-by: Sergey Senozhatsky
    Signed-off-by: Jan Kara

    Sergey Senozhatsky
     
  • - Skip locking if quota is dirty already.
    - Return old quota state to help fs-specciffic implementation to optimize
    case where quota was dirty already.

    Signed-off-by: Dmitry Monakhov
    Signed-off-by: Jan Kara

    Dmitry Monakhov
     

16 May, 2010

2 commits

  • To simplify metadata tracking for delalloc writes, ext4
    will simply claim metadata blocks at allocation time, without
    first speculatively reserving the worst case and then freeing
    what was not used.

    To do this, we need a mechanism to track allocations in
    the quota subsystem, but potentially allow that allocation
    to actually go over quota.

    This patch adds a DQUOT_SPACE_NOFAIL flag and function
    variants for this purpose.

    Signed-off-by: Eric Sandeen
    Signed-off-by: "Theodore Ts'o"

    Eric Sandeen
     
  • Switch __dquot_alloc_space and __dquot_free_space to take flags
    to indicate whether to warn and/or to reserve (or free reserve).

    This is slightly more readable at the callpoints, and makes it
    cleaner to add a "nofail" option in the next patch.

    Signed-off-by: Eric Sandeen
    Signed-off-by: "Theodore Ts'o"

    Eric Sandeen
     

21 Apr, 2010

1 commit

  • Make __DQUOT_PARANOIA define from the old days a standard config option
    and turn it off by default.

    This gets rid of a quota warning about writes before quota is turned on
    for systems with ext4 root filesystem. Currently there's no way to legally
    solve this because /etc/mtab has to be written before quota is turned on
    on most systems.

    Signed-off-by: Jan Kara

    Jan Kara