14 Oct, 2008

1 commit

  • This is a much better version of a previous patch to make the parser
    tables constant. Rather than changing the typedef, we put the "const" in
    all the various places where its required, allowing the __initconst
    exception for nfsroot which was the cause of the previous trouble.

    This was posted for review some time ago and I believe its been in -mm
    since then.

    Signed-off-by: Steven Whitehouse
    Cc: Alexander Viro
    Signed-off-by: Linus Torvalds

    Steven Whitehouse
     

09 Oct, 2008

1 commit


20 Aug, 2008

1 commit

  • There was another FAT BKL conversion deadlock reported by Bart
    Trojanowski due to the BKL being used as a recursive lock by FAT, which
    was missed because it only triggers with 'sync' (or 'dirsync') mounts.

    The recursion worked for the BKL, but after the conversion to lock_super
    (which uses a mutex), it just deadlocks.

    Thanks to Bart for debugging this and testing the fix. The lock
    debugging information from the original report:

    =============================================
    [ INFO: possible recursive locking detected ]
    2.6.27-rc3-bisect-00448-ga7f5aaf #16
    ---------------------------------------------
    mv/4020 is trying to acquire lock:
    (&type->s_lock_key#9){--..}, at: [] lock_super+0x1e/0x20

    but task is already holding lock:
    (&type->s_lock_key#9){--..}, at: [] lock_super+0x1e/0x20

    other info that might help us debug this:
    3 locks held by mv/4020:
    #0: (&sb->s_type->i_mutex_key#9/1){--..}, at: [] do_unlinkat+0x66/0x140
    #1: (&sb->s_type->i_mutex_key#9){--..}, at: [] vfs_unlink+0x84/0x110
    #2: (&type->s_lock_key#9){--..}, at: [] lock_super+0x1e/0x20

    stack backtrace:
    Pid: 4020, comm: mv Not tainted 2.6.27-rc3-bisect-00448-ga7f5aaf #16
    [] validate_chain+0x984/0xea0
    [] ? native_sched_clock+0x0/0xf0
    [] __lock_acquire+0x2ec/0x9b0
    [] lock_acquire+0x6f/0x90
    [] ? lock_super+0x1e/0x20
    [] mutex_lock_nested+0xad/0x300
    [] ? lock_super+0x1e/0x20
    [] ? lock_super+0x1e/0x20
    [] lock_super+0x1e/0x20
    [] fat_write_inode+0x60/0x2b0 [fat]
    [] ? _spin_unlock_irqrestore+0x48/0x80
    [] ? fat_sync_inode+0x3/0x20 [fat]
    [] fat_sync_inode+0x12/0x20 [fat]
    [] fat_remove_entries+0xbe/0x120 [fat]
    [] vfat_unlink+0x5f/0x90 [vfat]
    [] ? vfat_unlink+0x0/0x90 [vfat]
    [] vfs_unlink+0x98/0x110
    [] do_unlinkat+0x130/0x140
    [] ? audit_syscall_entry+0x105/0x150
    [] sys_unlinkat+0x3b/0x40
    [] sysenter_do_call+0x12/0x3f
    =======================

    where the deadlock is due to the nesting of lock_super from vfat_unlink
    to fat_write_inode:

    - do_unlinkat
    - vfs_unlink
    - vfat_unlink
    * lock_super
    - fat_remove_entries
    - fat_sync_inode
    - fat_write_inode
    * lock_super

    and the fix is to simply remove the use of lock_super() in fat_write_inode.

    The lock_super() there had been just an automatic conversion of the
    kernel lock to the superblock lock, but no locking was actually needed
    there, since the code in fat_write_inode already protected all relevant
    accesses with a spinlock (sbi->inode_hash_lock to be exact). The only
    code inside the BKL (and thus the superblock lock) was accesses tp local
    variables or calls to functions that have long been SMP-safe (i.e.
    sb_bread, mark_buffe_dirty and brlese).

    Bart reports:
    "Looks good. I ran 10 parallel processes creating 1M files truncating
    them, writing to them again and then deleting them. This patch fixes
    the issue I ran into.

    Signed-off-by: Bart Trojanowski "

    Reported-and-tested-by: Bart Trojanowski
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

03 Aug, 2008

1 commit


27 Jul, 2008

2 commits

  • The FAT_IOCTL_SET_ATTRIBUTES ioctl() calls notify_change() to change
    the file mode before changing the inode attributes. Replace with
    explicit calls to security_inode_setattr(), fat_setattr() and
    fsnotify_change().

    This is equivalent to the original. The reason it is needed, is that
    later in the series we move the immutable check into notify_change().
    That would break the FAT_IOCTL_SET_ATTRIBUTES ioctl, as it needs to
    perform the mode change regardless of the immutability of the file.

    [Fix error if fat is built as a module. Thanks to OGAWA Hirofumi for
    noticing.]

    Signed-off-by: Miklos Szeredi
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Al Viro

    Miklos Szeredi
     
  • Kmem cache passed to constructor is only needed for constructors that are
    themselves multiplexeres. Nobody uses this "feature", nor does anybody uses
    passed kmem cache in non-trivial way, so pass only pointer to object.

    Non-trivial places are:
    arch/powerpc/mm/init_64.c
    arch/powerpc/mm/hugetlbpage.c

    This is flag day, yes.

    Signed-off-by: Alexey Dobriyan
    Acked-by: Pekka Enberg
    Acked-by: Christoph Lameter
    Cc: Jon Tollefson
    Cc: Nick Piggin
    Cc: Matt Mackall
    [akpm@linux-foundation.org: fix arch/powerpc/mm/hugetlbpage.c]
    [akpm@linux-foundation.org: fix mm/slab.c]
    [akpm@linux-foundation.org: fix ubifs]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

26 Jul, 2008

6 commits

  • Provide a new mount option ("tz=UTC") for DOS (vfat/msdos) filesystems,
    allowing timestamps to be in coordinated universal time (UTC) rather than
    local time in applications where doing this is advantageous.

    In particular, portable devices that use fat/vfat (such as digital
    cameras) can benefit from using UTC in their internal clocks, thus
    avoiding daylight saving time errors and general time ambiguity issues.
    The user of the device does not have to worry about changing the time when
    moving from place or when daylight saving changes.

    The new mount option, when set, disables the counter-adjustment that Linux
    currently makes to FAT timestamp info in anticipation of the normal
    userspace time zone correction. When used in this new mode, all daylight
    saving time and time zone handling is done in userspace as is normal for
    many other filesystems (like ext3). The default mode, which remains
    unchanged, is still appropriate when mounting volumes written in Windows
    (because of its use of local time).

    I originally based this patch on one submitted last year by Paul Collins,
    but I updated it to work with current source and changed variable/option
    naming. Ogawa Hirofumi (who maintains these filesystems) and I discussed
    this patch at length on lkml, and he suggested using the option name in
    the attached version of the patch. Barry Bouwsma pointed out a good
    addition to the patch as well.

    Signed-off-by: Joe Peterson
    Signed-off-by: Paul Collins
    Acked-by: OGAWA Hirofumi
    Cc: Barry Bouwsma
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Peterson
     
  • This removes unnecessary parsing for directory entries.

    If short_only, we don't need to parse longname. And if !both and it found
    the longname, we don't need shortname.

    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     
  • This uses uses stack for shortname, and uses __getname() for longname in
    fat_search_long() and __fat_readdir(). By this, it removes unneeded
    __getname() for shortname.

    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     
  • This is no logic changes, just cleans fs/fat/dir.c up.

    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     
  • struct __fat_dirent is what was formerly the kernel struct dirent (that
    was different from the userspace struct dirent).

    Converting all fat users to struct __fat_dirent will allow us to get rid
    of the conflicting struct dirent definition.

    Signed-off-by: Adrian Bunk
    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     
  • Current parse_options() exits too early. We need to run the code of
    bottom in this function even if users doesn't specify options.

    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     

15 Jul, 2008

1 commit


03 Jul, 2008

1 commit


21 Jun, 2008

1 commit

  • This replaces the use of the BKL in the FAT family of filesystems with the
    existing superblock lock instead.

    The code already appears to do mostly proper locking with its own private
    spinlocks (and mutexes), but while the BKL could possibly have been
    dropped entirely, converting it to use the superblock lock (which is just
    a regular mutex) is the conservative thing to do.

    As a per-filesystem mutex, it not only won't have any of the possible
    latency issues related to the BKL, but the lock is obviously private to
    the particular filesystem instance and will thus not cause problems for
    entirely unrelated users like the BKL can.

    Signed-off-by: Linus Torvalds
    Cc: OGAWA Hirofumi
    Signed-off-by: Jonathan Corbet

    Linus Torvalds
     

13 Jun, 2008

1 commit

  • New chmod() allows only acceptable permission, and if not acceptable, it
    returns -EPERM. Old one allows even if it can't store permission to on
    disk inode. But it seems too strict for users.

    E.g. https://bugzilla.redhat.com/show_bug.cgi?id=449080: With new one,
    rsync couldn't create the temporary file.

    So, this patch allows like old one, but now it doesn't change the
    permission if it can't store, and it returns 0.

    Also, this patch fixes missing check.

    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     

30 Apr, 2008

1 commit


29 Apr, 2008

1 commit


28 Apr, 2008

10 commits

  • Annoying gcc warning:

    fs/fat/inode.c: In function 'fat_fill_super':
    fs/fat/inode.c:1222: warning: comparison is always false due to limited range of data type

    Change it to compare with 4K instead of PAGE_CACHE_SIZE, as suggested
    by OGAWA-san.

    [FAT spec says: logical_sector_size should be 512, 1024, 2048 4096]
    So, at least for now, we limit it to 4096.

    Signed-off-by: Olof Johansson
    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Olof Johansson
     
  • The on-disk media specification field in FAT is only 8-bits, so testing for

    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • __getname() is faster than __get_free_page(). Use it.

    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     
  • This patch fix the problem that the buffer allocated for convert of unicode to
    utf8 in fat/dir.c is too small.

    And cannot handle filename with 255 asian characters when mounted with utf8
    options.

    Also it fix the filename length limitation checking in vfat/namei.c that the
    filename length should be checked against the number of converted unicode
    characters.

    Not the length before NLS/UTF8 converted.

    Signed-off-by: Keith Mok
    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Keith Mok
     
  • This removes unneeded fat_clusters_flush().

    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     
  • Currently, free_clusters is not updated until it is trusted, because
    Windows doesn't update it correctly.

    But if user is using FAT driver of Linux, it updates free_clusters
    correctly. Instead, this updates it even if it's untrusted, so if
    free_clustes is correct, now keep correct value.

    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     
  • Normally utime(2) checks current process is owner of the file, or it
    has CAP_FOWNER capability. But FAT filesystem doesn't have uid/gid as
    on disk info, so normal check is too unflexible.

    With this option you can relax it.

    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     
  • Fix fat_setattr() on the case of showexec option. If user specified
    showexec option, inode->i_mode may not have S_IXUGO. This just use
    inode->i_mode to fix it.

    And with this patch, we don't allow chmod() on memory inode, it's just
    bad behaviour. IOW, we allow changing S_IWUGO only which can be stored
    to disk.

    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     
  • - Rename fat_notify_change() to fat_setattr()
    - check_mode() cleanup
    - Change layout of code

    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     
  • FAT doesn't need to check bad inode anymore.

    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     

19 Apr, 2008

1 commit


09 Feb, 2008

1 commit


08 Feb, 2008

2 commits


07 Feb, 2008

2 commits

  • This makes sure printk format strings contain no more than a single line.

    Signed-off-by: Vegard Nossum
    [the message was tweaked.]
    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vegard Nossum
     
  • Prohibit mode changes in non-quiet mode that cannot be stored reliably with
    the on-disk format.

    Suppose a vfat filesystem is mounted with umask=0 and [not-quiet]. Then
    all files will have mode 0777. Trying to change the owner will fail,
    because fat does not know about owners or groups. chmod 0770, on the other
    hand, will succeed, even though fat does not know about the permission
    triplet [user/group/other].

    So this patch changes fat's not-quiet behavior so that only UNIX modes are
    accepted that can be mapped lossless between the fat disk format and the
    local system. There is only one attribute, and that is the readonly
    attribute, which is mapped to the UNIX write permission bit(s). chmod 0555
    is therefore valid (taking away the +w bits setting the readonly
    attribute). Since chmod 0775 and chmod 0755 is an ambiguous case as to
    whether to set or clear the readonly bit, these modes are also denied.

    In quiet mode, chmod and chown will continue to "succeed" as they did
    before, meaning that a subsequent stat() will temporarily return the new
    mode as long as the inode is not reread from disk, and chown will silently
    do nothing, not even return the new uid/gid in stat().

    Signed-off-by: Jan Engelhardt
    Cc: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Engelhardt
     

09 Jan, 2008

1 commit

  • On large partition, scanning the free clusters is very slow if users
    doesn't use "usefree" option.

    For optimizing it, this patch uses sb_breadahead() to read of FAT
    sectors. On some user's 15GB partition, this patch improved it very
    much (1min => 600ms).

    The following is the result of 2GB partition on my machine.

    without patch:
    root@devron (/)# time df -h > /dev/null

    real 0m1.202s
    user 0m0.000s
    sys 0m0.440s

    with patch:
    root@devron (/)# time df -h > /dev/null

    real 0m0.378s
    user 0m0.012s
    sys 0m0.168s

    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     

22 Oct, 2007

2 commits

  • Now that nfsd has stopped writing to the find_exported_dentry member we an
    mark the export_operations const

    Signed-off-by: Christoph Hellwig
    Cc: Neil Brown
    Cc: "J. Bruce Fields"
    Cc:
    Cc: Dave Kleikamp
    Cc: Anton Altaparmakov
    Cc: David Chinner
    Cc: Timothy Shimmin
    Cc: OGAWA Hirofumi
    Cc: Hugh Dickins
    Cc: Chris Mason
    Cc: Jeff Mahoney
    Cc: "Vladimir V. Saveliev"
    Cc: Steven Whitehouse
    Cc: Mark Fasheh
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Hellwig
     
  • Very little changes here, fat had a mostly no op decode_fh before and does not
    store any parent information.

    Signed-off-by: Christoph Hellwig
    Cc: Neil Brown
    Cc: "J. Bruce Fields"
    Cc: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Hellwig
     

17 Oct, 2007

2 commits

  • Slab constructors currently have a flags parameter that is never used. And
    the order of the arguments is opposite to other slab functions. The object
    pointer is placed before the kmem_cache pointer.

    Convert

    ctor(void *object, struct kmem_cache *s, unsigned long flags)

    to

    ctor(struct kmem_cache *s, void *object)

    throughout the kernel

    [akpm@linux-foundation.org: coupla fixes]
    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     
  • Signed-off-by: Nick Piggin
    Cc: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nick Piggin
     

20 Jul, 2007

1 commit

  • Slab destructors were no longer supported after Christoph's
    c59def9f222d44bb7e2f0a559f2906191a0862d7 change. They've been
    BUGs for both slab and slub, and slob never supported them
    either.

    This rips out support for the dtor pointer from kmem_cache_create()
    completely and fixes up every single callsite in the kernel (there were
    about 224, not including the slab allocator definitions themselves,
    or the documentation references).

    Signed-off-by: Paul Mundt

    Paul Mundt