25 Oct, 2013

1 commit


13 Sep, 2013

1 commit


10 Jul, 2013

1 commit

  • This patch, originally from Android kernel, adds vfat ioctl command
    FAT_IOCTL_GET_VOLUME_ID, with this command we can get the vfat volume ID
    using following code:

    ioctl(fd, FAT_IOCTL_GET_VOLUME_ID, &volume_ID)

    This patch is a modified version of the patch by Mike Lockwood, with
    changes from Dmitry Pervushin, who noticed the original patch makes some
    volume IDs abiguous with error returns: for example, if volume id is
    0xFFFFFDAD, that matches -ENOIOCTLCMD, we get "FFFFFFFF" from the user
    space.

    So add a parameter to ioctl to get the correct volume ID.

    Android uses vfat volume ID to identify different sd card, when a new sd
    card is inserted to device, android can scan the media on it and pop up
    new contents.

    Signed-off-by: Bintian Wang
    Cc: dmitry pervushin
    Cc: Mike Lockwood
    Cc: Colin Cross
    Acked-by: OGAWA Hirofumi
    Cc: John Stultz
    Cc: Sean McNeil
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Lockwood
     

04 Jul, 2013

1 commit


29 Jun, 2013

2 commits

  • Instances either don't look at it at all (the majority of cases) or
    only want it to find the superblock (which can be had as dentry->d_sb).
    A few cases that want more are actually safe with dentry->d_inode -
    the only precaution needed is the check that it hadn't been replaced with
    NULL by rmdir() or by overwriting rename(), which case should be simply
    treated as cache miss.

    Signed-off-by: Linus Torvalds
    Signed-off-by: Al Viro

    Linus Torvalds
     
  • ... pox upon the idiotic ioctls; life would be much easier without
    those.

    Signed-off-by: Al Viro

    Al Viro
     

25 May, 2013

1 commit


08 May, 2013

1 commit

  • Faster kernel compiles by way of fewer unnecessary includes.

    [akpm@linux-foundation.org: fix fallout]
    [akpm@linux-foundation.org: fix build]
    Signed-off-by: Kent Overstreet
    Cc: Zach Brown
    Cc: Felipe Balbi
    Cc: Greg Kroah-Hartman
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Rusty Russell
    Cc: Jens Axboe
    Cc: Asai Thambi S P
    Cc: Selvan Mani
    Cc: Sam Bradshaw
    Cc: Jeff Moyer
    Cc: Al Viro
    Cc: Benjamin LaHaise
    Reviewed-by: "Theodore Ts'o"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kent Overstreet
     

30 Apr, 2013

6 commits

  • This patch enables rebuilding of directory inodes which are not present in
    the cache.This is done by traversing the disk clusters to find the
    directory entry of the parent directory and using its i_pos to build the
    inode.

    The traversal is done by fat_scan_logstart() which is similar to
    fat_scan() but matches i_pos values instead of names.fat_scan_logstart()
    needs an inode parameter to work, for which a dummy inode is created by
    it's caller fat_rebuild_parent(). This dummy inode is destroyed after the
    traversal completes.

    All this is done only if the nostale_ro nfs mount option is specified.

    Signed-off-by: Namjae Jeon
    Signed-off-by: Ravishankar N
    Signed-off-by: Amit Sahrawat
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namjae Jeon
     
  • If the cache lookups fail,use the i_pos value to find the directory entry
    of the inode and rebuild the inode.Since this involves accessing the FAT
    media, do this only if the nostale_ro nfs mount option is specified.

    Signed-off-by: Namjae Jeon
    Signed-off-by: Ravishankar N
    Signed-off-by: Amit Sahrawat
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namjae Jeon
     
  • Define two nfs export_operation structures,one for 'stale_rw' mounts and
    the other for 'nostale_ro'. The latter uses i_pos as a basis for encoding
    and decoding file handles.

    Also, assign i_pos to kstat->ino. The logic for rebuilding the inode is
    added in the subsequent patches.

    Signed-off-by: Namjae Jeon
    Signed-off-by: Ravishankar N
    Signed-off-by: Amit Sahrawat
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namjae Jeon
     
  • Introduce helper function to get the block number and offset for a given
    i_pos value. Use it in __fat_write_inode() now and later on in nfs.c

    Signed-off-by: Namjae Jeon
    Signed-off-by: Ravishankar N
    Signed-off-by: Amit Sahrawat
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namjae Jeon
     
  • Move fat_i_pos_read to fat.h so that it can be called from nfs.c in the
    subsequent patches to encode the file handle.

    Signed-off-by: Namjae Jeon
    Signed-off-by: Ravishankar N
    Signed-off-by: Amit Sahrawat
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namjae Jeon
     
  • This patchset eliminates the client side ESTALE errors when a FAT
    partition exported over NFS has its dentries evicted from the cache. The
    idea is to find the on-disk location_'i_pos' of the dirent of the inode
    that has been evicted and use it to rebuild the inode.

    This patch:

    Provide two possible values 'stale_rw' and 'nostale_ro' for the -o nfs
    mount option.The first one allows all file operations but does not reduce
    ESTALE errors on memory constrained systems. The second one eliminates
    ESTALE errors but mounts the filesystem as read-only. Not specifying a
    value defaults to 'stale_rw'.

    Signed-off-by: Namjae Jeon
    Signed-off-by: Ravishankar N
    Signed-off-by: Amit Sahrawat
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namjae Jeon
     

04 Mar, 2013

1 commit

  • Modify the request_module to prefix the file system type with "fs-"
    and add aliases to all of the filesystems that can be built as modules
    to match.

    A common practice is to build all of the kernel code and leave code
    that is not commonly needed as modules, with the result that many
    users are exposed to any bug anywhere in the kernel.

    Looking for filesystems with a fs- prefix limits the pool of possible
    modules that can be loaded by mount to just filesystems trivially
    making things safer with no real cost.

    Using aliases means user space can control the policy of which
    filesystem modules are auto-loaded by editing /etc/modprobe.d/*.conf
    with blacklist and alias directives. Allowing simple, safe,
    well understood work-arounds to known problematic software.

    This also addresses a rare but unfortunate problem where the filesystem
    name is not the same as it's module name and module auto-loading
    would not work. While writing this patch I saw a handful of such
    cases. The most significant being autofs that lives in the module
    autofs4.

    This is relevant to user namespaces because we can reach the request
    module in get_fs_type() without having any special permissions, and
    people get uncomfortable when a user specified string (in this case
    the filesystem type) goes all of the way to request_module.

    After having looked at this issue I don't think there is any
    particular reason to perform any filtering or permission checks beyond
    making it clear in the module request that we want a filesystem
    module. The common pattern in the kernel is to call request_module()
    without regards to the users permissions. In general all a filesystem
    module does once loaded is call register_filesystem() and go to sleep.
    Which means there is not much attack surface exposed by loading a
    filesytem module unless the filesystem is mounted. In a user
    namespace filesystems are not mounted unless .fs_flags = FS_USERNS_MOUNT,
    which most filesystems do not set today.

    Acked-by: Serge Hallyn
    Acked-by: Kees Cook
    Reported-by: Kees Cook
    Signed-off-by: "Eric W. Biederman"

    Eric W. Biederman
     

28 Feb, 2013

3 commits

  • I'm not sure why, but the hlist for each entry iterators were conceived

    list_for_each_entry(pos, head, member)

    The hlist ones were greedy and wanted an extra parameter:

    hlist_for_each_entry(tpos, pos, head, member)

    Why did they need an extra pos parameter? I'm not quite sure. Not only
    they don't really need it, it also prevents the iterator from looking
    exactly like the list iterator, which is unfortunate.

    Besides the semantic patch, there was some manual work required:

    - Fix up the actual hlist iterators in linux/list.h
    - Fix up the declaration of other iterators based on the hlist ones.
    - A very small amount of places were using the 'node' parameter, this
    was modified to use 'obj->member' instead.
    - Coccinelle didn't handle the hlist_for_each_entry_safe iterator
    properly, so those had to be fixed up manually.

    The semantic patch which is mostly the work of Peter Senna Tschudin is here:

    @@
    iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;

    type T;
    expression a,c,d,e;
    identifier b;
    statement S;
    @@

    -T b;

    [akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
    [akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
    [akpm@linux-foundation.org: checkpatch fixes]
    [akpm@linux-foundation.org: fix warnings]
    [akpm@linux-foudnation.org: redo intrusive kvm changes]
    Tested-by: Peter Senna Tschudin
    Acked-by: Paul E. McKenney
    Signed-off-by: Sasha Levin
    Cc: Wu Fengguang
    Cc: Marcelo Tosatti
    Cc: Gleb Natapov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sasha Levin
     
  • There is no documented methods to mark FAT as dirty. Unofficially MS
    started to use reserved Byte in boot sector for this purpose, at least
    since Win 2000. With Win 7 user is warned if fs is dirty and asked to
    clean it.

    Different versions of Win, handle it in different ways, but always have
    same meaning:

    - Win 2000 and XP, set it on write operations and
    remove it after operation was finnished
    - Win 7, set dirty flag on first write and remove it on umount.

    We will do it as follows:

    - set dirty flag on mount. If fs was initially dirty, warn user,
    remember it and do not do any changes to boot sector.
    - clean it on umount. If fs was initially dirty, leave it dirty.
    - do not do any thing if fs mounted read-only.
    - TODO: leave fs dirty if we found some error after mount.

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

    Oleksij Rempel
     
  • Later we will need "state" field to check if volume was cleanly unmounted.

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

    Oleksij Rempel
     

23 Feb, 2013

1 commit


21 Dec, 2012

1 commit

  • fat_search_long() returns 0 on success, -ENOENT/ENOMEM on failure.
    Change the function comment accordingly.

    While at it, fix some trivial typos.

    Signed-off-by: Ravishankar N
    Signed-off-by: Namjae Jeon
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ravishankar N
     

18 Dec, 2012

4 commits

  • Option parsing code expects an unsigned integer for the codepage option,
    but prefixes and stores this option with "cp" before passing to
    load_nls(). This makes the displayed option in /proc an invalid one.
    Strip the prefix when printing so that the displayed option is valid for
    reuse.

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

    Dave Reisner
     
  • parse_options() is supposed to return value < 0 on error however we
    returned 0 (success) in a lot of cases. This actually was not a problem
    in practice because match_token() used by parse_options() is clever and
    catches most of the problems for us.

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

    Jan Kara
     
  • So far FAT either offsets time stamps by sys_tz.minuteswest or leaves them
    as they are (when tz=UTC mount option is used). However in some cases it
    is useful if one can specify time stamp offset on his own (e.g. when time
    zone of the camera connected is different from time zone of the computer,
    or when HW clock is in UTC and thus sys_tz.minuteswest == 0).

    So provide a mount option time_offset= which allows user to specify offset
    in minutes that should be applied to time stamps on the filesystem.

    akpm: this code would work incorrectly when used via `mount -o remount',
    because cached inodes would not be updated. But fatfs's fat_remount() is
    basically a no-op anyway.

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

    Jan Kara
     
  • Change fatfs so that a warning is emitted when an attempt is made to mount
    a filesystem with the unsupported `discard' option.

    ext4 aready does this: http://patchwork.ozlabs.org/patch/192668/

    Signed-off-by: Namjae Jeon
    Signed-off-by: Amit Sahrawat
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namjae Jeon
     

10 Oct, 2012

1 commit


06 Oct, 2012

12 commits

  • [akpm@linux-foundation.org: checkpatch fixes]
    Signed-off-by: Namjae Jeon
    Signed-off-by: Amit Sahrawat
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namjae Jeon
     
  • #define FAT_ENT_EOF(EOF_FAT32)

    there is no need to reset value of 'new' for FAT32 as the values is
    already correct

    Signed-off-by: Namjae Jeon
    Signed-off-by: Amit Sahrawat
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namjae Jeon
     
  • 1: Stop any lines going over 80 characters
    2: Remove a blank line before EXPORT_SYMBOL_GPL

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

    Cruz Julian Bishop
     
  • 1: Import linux/uaccess.h instead of asm.uaccess.h
    2: Stop any lines going over 80 characters
    3: Stopped setting any variables in if statements
    4: Stopped splitting quoted strings
    5: Removed unneeded parentheses

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

    Cruz Julian Bishop
     
  • Simply remove the spacing between function definitions and
    EXPORT_SYMBOL_GPL calls, which were previously generating warnings.

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

    Cruz Julian Bishop
     
  • This does the following:
    1: Splits the arguments of a function call to stop it
    from exceeding 80 characters
    2: Re-indents the arguments of another function call
    to prevent the splitting of a quoted string.

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

    Cruz Julian Bishop
     
  • The comments were not lined up properly, so I just re-indented them.

    This also fixes a stupid checkpatch issue unknowingly

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

    Cruz Julian Bishop
     
  • Mainly fix spacing issues such as "foo * bar" and "foo= bar"

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

    Cruz Julian Bishop
     
  • Add a space before an equals sign/operator in line 410.

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

    Cruz Julian Bishop
     
  • Maintain an index of directory inodes by starting cluster, so that
    fat_get_parent() can return the proper cached inode rather than inventing
    one that cannot be traced back to the filesystem root.

    Add a new msdos/vfat binary mount option "nfs" so that FAT filesystems
    that are _not_ exported via NFS are not saddled with maintenance of an
    index they will never use.

    Finally, simplify NFS file handle generation and lookups. An
    ext2-congruent implementation is adequate for FAT needs.

    Signed-off-by: Steven J. Magnani
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Steven J. Magnani
     
  • Under memory pressure, the system may evict dentries from cache. When the
    FAT driver receives a NFS request involving an evicted dentry, it is
    unable to reconnect it to the filesystem root. This causes the request to
    fail, often with ENOENT.

    This is partially due to ineffectiveness of the current FAT NFS
    implementation, and partially due to an unimplemented fh_to_parent method.
    The latter can cause file accesses to fail on shares exported with
    subtree_check.

    This patch set provides the FAT driver with the ability to
    reconnect dentries. NFS file handle generation and lookups are simplified
    and made congruent with ext2.

    Testing has involved a memory-starved virtual machine running 3.5-rc5 that
    exports a ~2 GB vfat filesystem containing a kernel tree (~770 MB, ~40000
    files, 9 levels). Both 'cp -r' and 'ls -lR' operations were performed
    from a client, some overlapping, some consecutive. Exports with
    'subtree_check' and 'no_subtree_check' have been tested.

    Note that while this patch set improves FAT's NFS support, it does not
    eliminate ESTALE errors completely.

    The following should be considered for NFS clients who are sensitive to ESTALE:

    * Mounting with lookupcache=none
    Unfortunately this can degrade performance severely, particularly for deep
    filesystems.

    * Incorporating VFS patches to retry ESTALE failures on the client-side,
    such as https://lkml.org/lkml/2012/6/29/381

    * Handling ESTALE errors in client application code

    This patch:

    Move NFS-related code into its own C file. No functional changes.

    Signed-off-by: Steven J. Magnani
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Steven J. Magnani
     
  • Use accessor function for msdos_dir_entry 'start'

    Signed-off-by: Namjae Jeon
    Signed-off-by: Amit Sahrawat
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namjae Jeon
     

03 Oct, 2012

2 commits

  • Pull vfs update from Al Viro:

    - big one - consolidation of descriptor-related logics; almost all of
    that is moved to fs/file.c

    (BTW, I'm seriously tempted to rename the result to fd.c. As it is,
    we have a situation when file_table.c is about handling of struct
    file and file.c is about handling of descriptor tables; the reasons
    are historical - file_table.c used to be about a static array of
    struct file we used to have way back).

    A lot of stray ends got cleaned up and converted to saner primitives,
    disgusting mess in android/binder.c is still disgusting, but at least
    doesn't poke so much in descriptor table guts anymore. A bunch of
    relatively minor races got fixed in process, plus an ext4 struct file
    leak.

    - related thing - fget_light() partially unuglified; see fdget() in
    there (and yes, it generates the code as good as we used to have).

    - also related - bits of Cyrill's procfs stuff that got entangled into
    that work; _not_ all of it, just the initial move to fs/proc/fd.c and
    switch of fdinfo to seq_file.

    - Alex's fs/coredump.c spiltoff - the same story, had been easier to
    take that commit than mess with conflicts. The rest is a separate
    pile, this was just a mechanical code movement.

    - a few misc patches all over the place. Not all for this cycle,
    there'll be more (and quite a few currently sit in akpm's tree)."

    Fix up trivial conflicts in the android binder driver, and some fairly
    simple conflicts due to two different changes to the sock_alloc_file()
    interface ("take descriptor handling from sock_alloc_file() to callers"
    vs "net: Providing protocol type via system.sockprotoname xattr of
    /proc/PID/fd entries" adding a dentry name to the socket)

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (72 commits)
    MAX_LFS_FILESIZE should be a loff_t
    compat: fs: Generic compat_sys_sendfile implementation
    fs: push rcu_barrier() from deactivate_locked_super() to filesystems
    btrfs: reada_extent doesn't need kref for refcount
    coredump: move core dump functionality into its own file
    coredump: prevent double-free on an error path in core dumper
    usb/gadget: fix misannotations
    fcntl: fix misannotations
    ceph: don't abuse d_delete() on failure exits
    hypfs: ->d_parent is never NULL or negative
    vfs: delete surplus inode NULL check
    switch simple cases of fget_light to fdget
    new helpers: fdget()/fdput()
    switch o2hb_region_dev_write() to fget_light()
    proc_map_files_readdir(): don't bother with grabbing files
    make get_file() return its argument
    vhost_set_vring(): turn pollstart/pollstop into bool
    switch prctl_set_mm_exe_file() to fget_light()
    switch xfs_find_handle() to fget_light()
    switch xfs_swapext() to fget_light()
    ...

    Linus Torvalds
     
  • There's no reason to call rcu_barrier() on every
    deactivate_locked_super(). We only need to make sure that all delayed rcu
    free inodes are flushed before we destroy related cache.

    Removing rcu_barrier() from deactivate_locked_super() affects some fast
    paths. E.g. on my machine exit_group() of a last process in IPC
    namespace takes 0.07538s. rcu_barrier() takes 0.05188s of that time.

    Signed-off-by: Kirill A. Shutemov
    Cc: Al Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Al Viro

    Kirill A. Shutemov
     

20 Sep, 2012

1 commit