1. 16 7月, 2008 1 次提交
  2. 14 7月, 2008 2 次提交
    • E
      LSM/SELinux: show LSM mount options in /proc/mounts · 2069f457
      Eric Paris 提交于
      This patch causes SELinux mount options to show up in /proc/mounts.  As
      with other code in the area seq_put errors are ignored.  Other LSM's
      will not have their mount options displayed until they fill in their own
      security_sb_show_options() function.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Signed-off-by: NMiklos Szeredi <mszeredi@suse.cz>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      2069f457
    • S
      Security: split proc ptrace checking into read vs. attach · 006ebb40
      Stephen Smalley 提交于
      Enable security modules to distinguish reading of process state via
      proc from full ptrace access by renaming ptrace_may_attach to
      ptrace_may_access and adding a mode argument indicating whether only
      read access or full attach access is requested.  This allows security
      modules to permit access to reading process state without granting
      full ptrace access.  The base DAC/capability checking remains unchanged.
      
      Read access to /proc/pid/mem continues to apply a full ptrace attach
      check since check_mem_permission() already requires the current task
      to already be ptracing the target.  The other ptrace checks within
      proc for elements like environ, maps, and fds are changed to pass the
      read mode instead of attach.
      
      In the SELinux case, we model such reading of process state as a
      reading of a proc file labeled with the target process' label.  This
      enables SELinux policy to permit such reading of process state without
      permitting control or manipulation of the target process, as there are
      a number of cases where programs probe for such information via proc
      but do not need to be able to control the target (e.g. procps,
      lsof, PolicyKit, ConsoleKit).  At present we have to choose between
      allowing full ptrace in policy (more permissive than required/desired)
      or breaking functionality (or in some cases just silencing the denials
      via dontaudit rules but this can hide genuine attacks).
      
      This version of the patch incorporates comments from Casey Schaufler
      (change/replace existing ptrace_may_attach interface, pass access
      mode), and Chris Wright (provide greater consistency in the checking).
      
      Note that like their predecessors __ptrace_may_attach and
      ptrace_may_attach, the __ptrace_may_access and ptrace_may_access
      interfaces use different return value conventions from each other (0
      or -errno vs. 1 or 0).  I retained this difference to avoid any
      changes to the caller logic but made the difference clearer by
      changing the latter interface to return a bool rather than an int and
      by adding a comment about it to ptrace.h for any future callers.
      Signed-off-by: NStephen Smalley <sds@tycho.nsa.gov>
      Acked-by: NChris Wright <chrisw@sous-sol.org>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      006ebb40
  3. 13 7月, 2008 2 次提交
  4. 12 7月, 2008 8 次提交
    • E
      ext4: do not set extents feature from the kernel · e4079a11
      Eric Sandeen 提交于
      We've talked for a while about getting rid of any feature-
      setting from the kernel; this gets rid of the code which would
      set the INCOMPAT_EXTENTS flag on the first file write when mounted
      as ext4[dev].
      
      With this patch, if the extents feature is not already set on disk,
      then mounting as ext4 will fall back to noextents with a warning,
      and if -o extents is explicitly requested, the mount will fail,
      also with warning.
      Signed-off-by: NEric Sandeen <sandeen@redhat.com>
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      e4079a11
    • A
      ext4: Don't allow nonextenst mount option for large filesystem · c07651b5
      Aneesh Kumar K.V 提交于
      The block mapped inode format can address only blocks within 2**32. This
      causes a number of issues, the biggest of which is that the block
      allocator needs to be taught that certain inodes can not utilize block
      numbers > 2**32.  So until this is fixed, it is simplest to fail
      mounting of file systems with more than 2**32 blocks if the -o noextents
      option is given.
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: NMingming Cao <cmm@us.ibm.com>
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      c07651b5
    • A
      ext4: Enable delalloc by default. · dd919b98
      Aneesh Kumar K.V 提交于
      Enable delalloc by default to ensure it gets sufficient testing and
      because it makes the filesystem much more efficient.  Add a nodealalloc
      option to disable delayed allocation, and update ext4_show_options to
      show delayed allocation off if it is disabled.
      
      If the data=journal mount option is used, disable delayed allocation
      since the delalloc code doesn't support data=journal yet.
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: NMingming Cao <cmm@us.ibm.com>
      dd919b98
    • M
      ext4: delayed allocation i_blocks fix for stat · 3e3398a0
      Mingming Cao 提交于
      Right now i_blocks is not getting updated until the blocks are actually
      allocaed on disk.  This means with delayed allocation, right after files
      are copied, "ls -sF" shoes the file as taking 0 blocks on disk.  "du"
      also shows the files taking zero space, which is highly confusing to the
      user.
      
      Since delayed allocation already keeps track of per-inode total
      number of blocks that are subject to delayed allocation, this patch fix
      this by using that to adjust the value returned by stat(2). When real
      block allocation is done, the i_blocks will get updated. Since the
      reserved blocks for delayed allocation will be decreased, this will be
      keep value returned by stat(2) consistent.
      Signed-off-by: NMingming Cao <cmm@us.ibm.com>
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      3e3398a0
    • M
      ext4: fix delalloc i_disksize early update issue · 632eaeab
      Mingming Cao 提交于
      Ext4_da_write_end() used walk_page_buffers() with a callback function of
      ext4_bh_unmapped_or_delay() to check if it extended the file size
      without allocating any blocks (since in this case i_disksize needs to be
      updated).  However, this is didn't work proprely because the buffer head
      has not been marked dirty yet --- this is done later in
      block_commit_write() --- which caused ext4_bh_unmapped_or_delay() to
      always return false.
      
      In addition, walk_page_buffers() checks all of the buffer heads covering
      the page, and the only buffer_head that should be checked is the one
      covering the end of the write.  Otherwise, given a 1k blocksize
      filesystem and a 4k page size, the buffer head covering the first 1k
      stripe of the file could be unmapped (because it was a sparse file), and
      the second or third buffer_head covering that page could be mapped, and
      using walk_page_buffers() would fail in this case since it would stop at
      the first unmapped buffer_head and return true.
      
      The core problem is that walk_page_buffers() was intended to do work in
      a callback function, and a non-zero return value indicated a failure,
      which termined the walk of the buffer heads covering the page.  It was
      not intended to be used with a boolean function, such as
      ext4_bh_unmapped_or_delay().
      
      Add addtional fix from Aneesh to protect i_disksize update rave with truncate.
      Signed-off-by: NMingming Cao <cmm@us.ibm.com>
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      632eaeab
    • A
      ext4: Handle page without buffers in ext4_*_writepage() · f0e6c985
      Aneesh Kumar K.V 提交于
      It can happen that buffers are removed from the page before it gets
      marked dirty and then is passed to writepage().  In writepage() we just
      initialize the buffers and check whether they are mapped and non
      delay. If they are mapped and non delay we write the page. Otherwise we
      mark them dirty.  With this change we don't do block allocation at all
      in ext4_*_write_page.
      
      writepage() can get called under many condition and with a locking order
      of journal_start -> lock_page, we should not try to allocate blocks in
      writepage() which get called after taking page lock.  writepage() can
      get called via shrink_page_list even with a journal handle which was
      created for doing inode update.  For example when doing
      ext4_da_write_begin we create a journal handle with credit 1 expecting a
      i_disksize update for the inode. But ext4_da_write_begin can cause
      shrink_page_list via _grab_page_cache. So having a valid handle via
      ext4_journal_current_handle is not a guarantee that we can use the
      handle for block allocation in writepage, since we shouldn't be using
      credits that had been reserved for other updates.  That it could result
      in we running out of credits when we update inodes.
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: NMingming Cao <cmm@us.ibm.com>
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      f0e6c985
    • A
      ext4: Add ordered mode support for delalloc · cd1aac32
      Aneesh Kumar K.V 提交于
      This provides a new ordered mode implementation which gets rid of using
      buffer heads to enforce the ordering between metadata change with the
      related data chage.  Instead, in the new ordering mode, it keeps track
      of all of the inodes touched by each transaction on a list, and when
      that transaction is committed, it flushes all of the dirty pages for
      those inodes.  In addition, the new ordered mode reverses the lock
      ordering of the page lock and transaction lock, which provides easier
      support for delayed allocation.
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: NMingming Cao <cmm@us.ibm.com>
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      cd1aac32
    • M
      ext4: Invert lock ordering of page_lock and transaction start in delalloc · 61628a3f
      Mingming Cao 提交于
      With the reverse locking, we need to start a transation before taking
      the page lock, so in ext4_da_writepages() we need to break the write-out
      into chunks, and restart the journal for each chunck to ensure the
      write-out fits in a single transaction.
      
      Updated patch from Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      which fixes delalloc sync hang with journal lock inversion, and address
      the performance regression issue.
      Signed-off-by: NMingming Cao <cmm@us.ibm.com>
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      61628a3f
  5. 15 7月, 2008 1 次提交
    • M
      ext4: delayed allocation ENOSPC handling · d2a17637
      Mingming Cao 提交于
      This patch does block reservation for delayed
      allocation, to avoid ENOSPC later at page flush time.
      
      Blocks(data and metadata) are reserved at da_write_begin()
      time, the freeblocks counter is updated by then, and the number of
      reserved blocks is store in per inode counter.
              
      At the writepage time, the unused reserved meta blocks are returned
      back. At unlink/truncate time, reserved blocks are properly released.
      
      Updated fix from  Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      to fix the oldallocator block reservation accounting with delalloc, added
      lock to guard the counters and also fix the reservation for meta blocks.
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: NMingming Cao <cmm@us.ibm.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      d2a17637
  6. 12 7月, 2008 26 次提交