1. 16 4月, 2015 1 次提交
  2. 21 1月, 2015 1 次提交
  3. 20 10月, 2014 1 次提交
  4. 03 4月, 2014 1 次提交
  5. 04 3月, 2013 1 次提交
    • E
      fs: Limit sys_mount to only request filesystem modules. · 7f78e035
      Eric W. Biederman 提交于
      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: NSerge Hallyn <serge.hallyn@canonical.com>
      Acked-by: NKees Cook <keescook@chromium.org>
      Reported-by: NKees Cook <keescook@google.com>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      7f78e035
  6. 10 10月, 2012 1 次提交
  7. 03 10月, 2012 1 次提交
  8. 02 8月, 2012 1 次提交
  9. 21 5月, 2012 2 次提交
    • S
      exofs: Add SYSFS info for autologin/pNFS export · 8b56a30c
      Sachin Bhamare 提交于
      Introduce sysfs infrastructure for exofs cluster filesystem.
      
      Each OSD target shows up as below in the sysfs hierarchy:
      	/sys/fs/exofs/<osdname>_<partition_id>/devX
      
      Where <osdname>_<partition_id> is the unique identification
      of a Superblock.
      
      Where devX: 0 <= X < device_table_size. They are ordered
      in device-table order as specified to the mkfs.exofs command
      
      Each OSD device  devX has following attributes :
      	osdname - ReadOnly
      	systemid - ReadOnly
      	uri - Read/Write
      
      It is up to user-mode to update devX/uri for support of
      autologin.
      
      These sysfs information are used both for autologin as well
      as support for exporting exofs via a pNFSD server in user-mode.
      (.eg NFS-Ganesha)
      Signed-off-by: NSachin Bhamare <sbhamare@panasas.com>
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      8b56a30c
    • B
      exofs: Fix CRASH on very early IO errors. · 6abe4a87
      Boaz Harrosh 提交于
      If at exofs_fill_super() we had an early termination
      do to any error, like an IO error while reading the
      super-block. We would crash inside exofs_free_sbi().
      
      This is because sbi->oc.numdevs was set to 1, before
      we actually have a device table at all.
      
      Fix it by moving the sbi->oc.numdevs = 1 to after the
      allocation of the device table.
      Reported-by: NJohannes Schild <JSchild@gmx.de>
      
      Stable: This is a bug since v3.2.0
      CC: Stable Tree <stable@kernel.org>
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      6abe4a87
  10. 21 3月, 2012 2 次提交
  11. 20 3月, 2012 3 次提交
  12. 09 1月, 2012 1 次提交
  13. 04 1月, 2012 1 次提交
    • A
      vfs: fix the stupidity with i_dentry in inode destructors · 6b520e05
      Al Viro 提交于
      Seeing that just about every destructor got that INIT_LIST_HEAD() copied into
      it, there is no point whatsoever keeping this INIT_LIST_HEAD in inode_init_once();
      the cost of taking it into inode_init_always() will be negligible for pipes
      and sockets and negative for everything else.  Not to mention the removal of
      boilerplate code from ->destroy_inode() instances...
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      6b520e05
  14. 01 11月, 2011 1 次提交
    • P
      fs: add module.h to files that were implicitly using it · 143cb494
      Paul Gortmaker 提交于
      Some files were using the complete module.h infrastructure without
      actually including the header at all.  Fix them up in advance so
      once the implicit presence is removed, we won't get failures like this:
      
        CC [M]  fs/nfsd/nfssvc.o
      fs/nfsd/nfssvc.c: In function 'nfsd_create_serv':
      fs/nfsd/nfssvc.c:335: error: 'THIS_MODULE' undeclared (first use in this function)
      fs/nfsd/nfssvc.c:335: error: (Each undeclared identifier is reported only once
      fs/nfsd/nfssvc.c:335: error: for each function it appears in.)
      fs/nfsd/nfssvc.c: In function 'nfsd':
      fs/nfsd/nfssvc.c:555: error: implicit declaration of function 'module_put_and_exit'
      make[3]: *** [fs/nfsd/nfssvc.o] Error 1
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      143cb494
  15. 15 10月, 2011 1 次提交
    • B
      ore/exofs: Define new ore_verify_layout · 5a51c0c7
      Boaz Harrosh 提交于
      All users of the ore will need to check if current code
      supports the given layout. For example RAID5/6 is not
      currently supported.
      
      So move all the checks from exofs/super.c to a new
      ore_verify_layout() to be used by ore users.
      
      Note that any new layout should be passed through the
      ore_verify_layout() because the ore engine will prepare
      and verify some internal members of ore_layout, and
      assumes it's called.
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      5a51c0c7
  16. 04 10月, 2011 1 次提交
    • B
      ore/exofs: Change the type of the devices array (API change) · d866d875
      Boaz Harrosh 提交于
      In the pNFS obj-LD the device table at the layout level needs
      to point to a device_cache node, where it is possible and likely
      that many layouts will point to the same device-nodes.
      
      In Exofs we have a more orderly structure where we have a single
      array of devices that repeats twice for a round-robin view of the
      device table
      
      This patch moves to a model that can be used by the pNFS obj-LD
      where struct ore_components holds an array of ore_dev-pointers.
      (ore_dev is newly defined and contains a struct osd_dev *od
       member)
      
      Each pointer in the array of pointers will point to a bigger
      user-defined dev_struct. That can be accessed by use of the
      container_of macro.
      
      In Exofs an __alloc_dev_table() function allocates the
      ore_dev-pointers array as well as an exofs_dev array, in one
      allocation and does the addresses dance to set everything pointing
      correctly. It still keeps the double allocation trick for the
      inodes round-robin view of the table.
      
      The device table is always allocated dynamically, also for the
      single device case. So it is unconditionally freed at umount.
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      d866d875
  17. 03 10月, 2011 3 次提交
  18. 07 8月, 2011 3 次提交
    • B
      exofs: Rename raid engine from exofs/ios.c => ore · 8ff660ab
      Boaz Harrosh 提交于
      ORE stands for "Objects Raid Engine"
      
      This patch is a mechanical rename of everything that was in ios.c
      and its API declaration to an ore.c and an osd_ore.h header. The ore
      engine will later be used by the pnfs objects layout driver.
      
      * File ios.c => ore.c
      
      * Declaration of types and API are moved from exofs.h to a new
        osd_ore.h
      
      * All used types are prefixed by ore_ from their exofs_ name.
      
      * Shift includes from exofs.h to osd_ore.h so osd_ore.h is
        independent, include it from exofs.h.
      
      Other than a pure rename there are no other changes. Next patch
      will move the ore into it's own module and will export the API
      to be used by exofs and later the layout driver
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      8ff660ab
    • B
      exofs: ios: Move to a per inode components & device-table · 9e9db456
      Boaz Harrosh 提交于
      Exofs raid engine was saving on memory space by having a single layout-info,
      single pid, and a single device-table, global to the filesystem. Then passing
      a credential and object_id info at the io_state level, private for each
      inode. It would also devise this contraption of rotating the device table
      view for each inode->ino to spread out the device usage.
      
      This is not compatible with the pnfs-objects standard, demanding that
      each inode can have it's own layout-info, device-table, and each object
      component it's own pid, oid and creds.
      
      So: Bring exofs raid engine to be usable for generic pnfs-objects use by:
      
      * Define an exofs_comp structure that holds obj_id and credential info.
      
      * Break up exofs_layout struct to an exofs_components structure that holds a
        possible array of exofs_comp and the array of devices + the size of the
        arrays.
      
      * Add a "comps" parameter to get_io_state() that specifies the ids creds
        and device array to use for each IO.
      
        This enables to keep the layout global, but the device-table view, creds
        and IDs at the inode level. It only adds two 64bit to each inode, since
        some of these members already existed in another form.
      
      * ios raid engine now access layout-info and comps-info through the passed
        pointers. Everything is pre-prepared by caller for generic access of
        these structures and arrays.
      
      At the exofs Level:
      
      * Super block holds an exofs_components struct that holds the device
        array, previously in layout. The devices there are in device-table
        order. The device-array is twice bigger and repeats the device-table
        twice so now each inode's device array can point to a random device
        and have a round-robin view of the table, making it compatible to
        previous exofs versions.
      
      * Each inode has an exofs_components struct that is initialized at
        load time, with it's own view of the device table IDs and creds.
        When doing IO this gets passed to the io_state together with the
        layout.
      
      While preforming this change. Bugs where found where credentials with the
      wrong IDs where used to access the different SB objects (super.c). As well
      as some dead code. It was never noticed because the target we use does not
      check the credentials.
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      9e9db456
    • B
      exofs: Move exofs specific osd operations out of ios.c · 85e44df4
      Boaz Harrosh 提交于
      ios.c will be moving to an external library, for use by the
      objects-layout-driver. Remove from it some exofs specific functions.
      
      Also g_attr_logical_length is used both by inode.c and ios.c
      move definition to the later, to keep it independent
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      85e44df4
  19. 05 8月, 2011 2 次提交
    • B
      exofs: Small cleanup of exofs_fill_super · 9ce73047
      Boaz Harrosh 提交于
      Small cleanup that unifies duplicated code used in both the
      error and success cases
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      9ce73047
    • B
      exofs: BUG: Avoid sbi realloc · 6d4073e8
      Boaz Harrosh 提交于
      Since the beginning we realloced the sbi structure when a bigger
      then one device table was specified. (I know that was really stupid).
      
      Then much later when "register bdi" was added (By Jens) it was
      registering the pointer to sbi->bdi before the realloc.
      
      We never saw this problem because up till now the realloc did not
      do anything since the device table was small enough to fit in the
      original allocation. But once we starting testing with large device
      tables (Bigger then 28) we noticed the crash of writeback operating
      on a deallocated pointer.
      
      * Avoid the all mess by allocating the device-table as a second array
        and get rid of the variable-sized structure and the rest of this
        mess.
      * Take the chance to clean near by structures and comments.
      * Add a needed dprint on startup to indicate the loaded layout.
      * Also move the bdi registration to the very end because it will
        only fail in a low memory, which will probably fail before hand.
        There are many more likely causes to not load before that. This
        way the error handling is made simpler. (Just doing this would be
        enough to fix the BUG)
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      6d4073e8
  20. 18 7月, 2011 1 次提交
  21. 15 3月, 2011 5 次提交
    • B
      exofs: deprecate the commands pending counter · a49fb4c3
      Boaz Harrosh 提交于
      One leftover from the days of IBM's original code, is an SB counter
      that counts in-flight asynchronous commands. And a piece of code that
      waits for the counter to reach zero at unmount. I guess it might have
      been needed then, cause of some reference missing or something.
      
      I'm not removing it yet but am putting a warning message if ever this
      counter triggers at unmount. If I'll never see it triggers or reported
      I'll remove the counter for good.
      (I had this print as a debug output for a long time and never had it
       trigger)
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      a49fb4c3
    • B
      exofs: Write sbi->s_nextid as part of the Create command · 1cea312a
      Boaz Harrosh 提交于
      Before when creating a new inode, we'd set the sb->s_dirt flag,
      and sometime later the system would write out s_nextid as part
      of the sb_info. Also on inode sync we would force the sb sync
      as well.
      
      Define the s_nextid as a new partition attribute and set it
      every time we create a new object.
      At mount we read it from it's new place.
      
      We now never set sb->s_dirt anywhere in exofs. write_super
      is actually never called. The call to exofs_write_super from
      exofs_put_super is also removed because the VFS always calls
      ->sync_fs before calling ->put_super twice.
      
      To stay backward-and-forward compatible we also write the old
      s_nextid in the super_block object at unmount, and support zero
      length attribute on mount.
      
      This also fixes a BUG where in layouts when group_width was not
      a divisor of EXOFS_SUPER_ID (0x10000) the s_nextid was not read
      from the device it was written to. Because of the sliding window
      layout trick, and because the read was always done from the 0
      device but the write was done via the raid engine that might slide
      the device view. Now we read and write through the raid engine.
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      1cea312a
    • B
      exofs: Add option to mount by osdname · 9ed96484
      Boaz Harrosh 提交于
      If /dev/osd* devices are shuffled because more devices
      where added, and/or login order has changed. It is hard to
      mount the FS you want.
      
      Add an option to mount by osdname. osdname is any osd-device's
      osdname as specified to the mkfs.exofs command when formatting
      the osd-devices.
      The new mount format is:
      	OPT="osdname=$UUID0,pid=$PID,_netdev"
      	mount -t exofs -o $OPT $DEV_OSD0 $MOUNTDIR
      
      if "osdname=" is specified in options above $DEV_OSD0 is
      ignored and can be empty.
      
      Also while at it: Removed some old unused Opt_* enums.
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      9ed96484
    • B
      exofs: Override read-ahead to align on stripe_size · 66cd6cad
      bharrosh@panasas.com 提交于
      * Set all inode->i_mapping->backing_dev_info to point to
        the per super-block sb->s_bdi.
      
      * Calculating a read_ahead that is:
        - preferable 2 stripes long
          (Future patch will add a mount option to override this)
        - Minimum 128K aligned up to stripe-size
        - Caped to maximum-IO-sizes round down to stripe_size.
          (Max sizes are governed by max bio-size that fits in a page
           times number-of-devices)
      
      CC: Marc Dionne <marc.c.dionne@gmail.com>
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      66cd6cad
    • T
      exofs: Remove redundant unlikely() · 2c722c9a
      Tobias Klauser 提交于
      IS_ERR() already implies unlikely(), so it can be omitted here.
      Signed-off-by: NTobias Klauser <tklauser@distanz.ch>
      2c722c9a
  22. 07 1月, 2011 1 次提交
    • N
      fs: icache RCU free inodes · fa0d7e3d
      Nick Piggin 提交于
      RCU free the struct inode. This will allow:
      
      - Subsequent store-free path walking patch. The inode must be consulted for
        permissions when walking, so an RCU inode reference is a must.
      - sb_inode_list_lock to be moved inside i_lock because sb list walkers who want
        to take i_lock no longer need to take sb_inode_list_lock to walk the list in
        the first place. This will simplify and optimize locking.
      - Could remove some nested trylock loops in dcache code
      - Could potentially simplify things a bit in VM land. Do not need to take the
        page lock to follow page->mapping.
      
      The downsides of this is the performance cost of using RCU. In a simple
      creat/unlink microbenchmark, performance drops by about 10% due to inability to
      reuse cache-hot slab objects. As iterations increase and RCU freeing starts
      kicking over, this increases to about 20%.
      
      In cases where inode lifetimes are longer (ie. many inodes may be allocated
      during the average life span of a single inode), a lot of this cache reuse is
      not applicable, so the regression caused by this patch is smaller.
      
      The cache-hot regression could largely be avoided by using SLAB_DESTROY_BY_RCU,
      however this adds some complexity to list walking and store-free path walking,
      so I prefer to implement this at a later date, if it is shown to be a win in
      real situations. I haven't found a regression in any non-micro benchmark so I
      doubt it will be a problem.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      fa0d7e3d
  23. 29 10月, 2010 1 次提交
  24. 10 8月, 2010 1 次提交
  25. 04 8月, 2010 1 次提交
  26. 22 4月, 2010 1 次提交
  27. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6