1. 12 4月, 2015 3 次提交
    • T
      ext4 crypto: enforce context consistency · d9cdc903
      Theodore Ts'o 提交于
      Enforce the following inheritance policy:
      
      1) An unencrypted directory may contain encrypted or unencrypted files
      or directories.
      
      2) All files or directories in a directory must be protected using the
      same key as their containing directory.
      
      As a result, assuming the following setup:
      
      mke2fs -t ext4 -Fq -O encrypt /dev/vdc
      mount -t ext4 /dev/vdc /vdc
      mkdir /vdc/a /vdc/b /vdc/c
      echo foo | e4crypt add_key /vdc/a
      echo bar | e4crypt add_key /vdc/b
      for i in a b c ; do cp /etc/motd /vdc/$i/motd-$i ; done
      
      Then we will see the following results:
      
      cd /vdc
      mv a b			# will fail; /vdc/a and /vdc/b have different keys
      mv b/motd-b a		# will fail, see above
      ln a/motd-a b		# will fail, see above
      mv c a	    		# will fail; all inodes in an encrypted directory
         	  		#	must be encrypted
      ln c/motd-c b		# will fail, see above
      mv a/motd-a c		# will succeed
      mv c/motd-a a		# will succeed
      Signed-off-by: NMichael Halcrow <mhalcrow@google.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      d9cdc903
    • M
    • M
      ext4 crypto: add ext4 encryption facilities · b30ab0e0
      Michael Halcrow 提交于
      On encrypt, we will re-assign the buffer_heads to point to a bounce
      page rather than the control_page (which is the original page to write
      that contains the plaintext). The block I/O occurs against the bounce
      page.  On write completion, we re-assign the buffer_heads to the
      original plaintext page.
      
      On decrypt, we will attach a read completion callback to the bio
      struct. This read completion will decrypt the read contents in-place
      prior to setting the page up-to-date.
      
      The current encryption mode, AES-256-XTS, lacks cryptographic
      integrity. AES-256-GCM is in-plan, but we will need to devise a
      mechanism for handling the integrity data.
      Signed-off-by: NMichael Halcrow <mhalcrow@google.com>
      Signed-off-by: NIldar Muslukhov <ildarm@google.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      b30ab0e0
  2. 11 4月, 2015 5 次提交
  3. 08 4月, 2015 1 次提交
  4. 03 4月, 2015 11 次提交
  5. 17 2月, 2015 1 次提交
  6. 15 2月, 2015 1 次提交
    • O
      ext4: fix indirect punch hole corruption · 6f30b7e3
      Omar Sandoval 提交于
      Commit 4f579ae7 (ext4: fix punch hole on files with indirect
      mapping) rewrote FALLOC_FL_PUNCH_HOLE for ext4 files with indirect
      mapping. However, there are bugs in several corner cases. This fixes 5
      distinct bugs:
      
      1. When there is at least one entire level of indirection between the
      start and end of the punch range and the end of the punch range is the
      first block of its level, we can't return early; we have to free the
      intervening levels.
      
      2. When the end is at a higher level of indirection than the start and
      ext4_find_shared returns a top branch for the end, we still need to free
      the rest of the shared branch it returns; we can't decrement partial2.
      
      3. When a punch happens within one level of indirection, we need to
      converge on an indirect block that contains the start and end. However,
      because the branches returned from ext4_find_shared do not necessarily
      start at the same level (e.g., the partial2 chain will be shallower if
      the last block occurs at the beginning of an indirect group), the walk
      of the two chains can end up "missing" each other and freeing a bunch of
      extra blocks in the process. This mismatch can be handled by first
      making sure that the chains are at the same level, then walking them
      together until they converge.
      
      4. When the punch happens within one level of indirection and
      ext4_find_shared returns a top branch for the start, we must free it,
      but only if the end does not occur within that branch.
      
      5. When the punch happens within one level of indirection and
      ext4_find_shared returns a top branch for the end, then we shouldn't
      free the block referenced by the end of the returned chain (this mirrors
      the different levels case).
      Signed-off-by: NOmar Sandoval <osandov@osandov.com>
      6f30b7e3
  7. 13 2月, 2015 4 次提交
  8. 11 2月, 2015 1 次提交
  9. 05 2月, 2015 2 次提交
    • T
      ext4: add optimization for the lazytime mount option · a26f4992
      Theodore Ts'o 提交于
      Add an optimization for the MS_LAZYTIME mount option so that we will
      opportunistically write out any inodes with the I_DIRTY_TIME flag set
      in a particular inode table block when we need to update some inode in
      that inode table block anyway.
      
      Also add some temporary code so that we can set the lazytime mount
      option without needing a modified /sbin/mount program which can set
      MS_LAZYTIME.  We can eventually make this go away once util-linux has
      added support.
      
      Google-Bug-Id: 18297052
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      a26f4992
    • T
      vfs: add support for a lazytime mount option · 0ae45f63
      Theodore Ts'o 提交于
      Add a new mount option which enables a new "lazytime" mode.  This mode
      causes atime, mtime, and ctime updates to only be made to the
      in-memory version of the inode.  The on-disk times will only get
      updated when (a) if the inode needs to be updated for some non-time
      related change, (b) if userspace calls fsync(), syncfs() or sync(), or
      (c) just before an undeleted inode is evicted from memory.
      
      This is OK according to POSIX because there are no guarantees after a
      crash unless userspace explicitly requests via a fsync(2) call.
      
      For workloads which feature a large number of random write to a
      preallocated file, the lazytime mount option significantly reduces
      writes to the inode table.  The repeated 4k writes to a single block
      will result in undesirable stress on flash devices and SMR disk
      drives.  Even on conventional HDD's, the repeated writes to the inode
      table block will trigger Adjacent Track Interference (ATI) remediation
      latencies, which very negatively impact long tail latencies --- which
      is a very big deal for web serving tiers (for example).
      
      Google-Bug-Id: 18297052
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      0ae45f63
  10. 30 1月, 2015 1 次提交
    • J
      ext4: Use generic helpers for quotaon and quotaoff · 1fa5efe3
      Jan Kara 提交于
      Ext4 can just use the generic helpers provided by quota code for turning
      quotas on and off when quota files are stored as system inodes. The only
      difference is the feature test in ext4_quota_on_sysfile() but the same
      is achieved in dquot_quota_enable() by checking whether usage tracking
      for the corresponding quota type is enabled (which can happen only if
      quota feature is set).
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJan Kara <jack@suse.cz>
      1fa5efe3
  11. 27 1月, 2015 1 次提交
  12. 21 1月, 2015 1 次提交
  13. 20 1月, 2015 1 次提交
  14. 03 1月, 2015 2 次提交
  15. 27 12月, 2014 1 次提交
  16. 17 12月, 2014 1 次提交
  17. 06 12月, 2014 1 次提交
    • D
      ext4: ext4_da_convert_inline_data_to_extent drop locked page after error · 50db71ab
      Dmitry Monakhov 提交于
      Testcase:
      xfstests generic/270
      MKFS_OPTIONS="-q -I 256 -O inline_data,64bit"
      
      Call Trace:
       [<ffffffff81144c76>] lock_page+0x35/0x39 -------> DEADLOCK
       [<ffffffff81145260>] pagecache_get_page+0x65/0x15a
       [<ffffffff811507fc>] truncate_inode_pages_range+0x1db/0x45c
       [<ffffffff8120ea63>] ? ext4_da_get_block_prep+0x439/0x4b6
       [<ffffffff811b29b7>] ? __block_write_begin+0x284/0x29c
       [<ffffffff8120e62a>] ? ext4_change_inode_journal_flag+0x16b/0x16b
       [<ffffffff81150af0>] truncate_inode_pages+0x12/0x14
       [<ffffffff81247cb4>] ext4_truncate_failed_write+0x19/0x25
       [<ffffffff812488cf>] ext4_da_write_inline_data_begin+0x196/0x31c
       [<ffffffff81210dad>] ext4_da_write_begin+0x189/0x302
       [<ffffffff810c07ac>] ? trace_hardirqs_on+0xd/0xf
       [<ffffffff810ddd13>] ? read_seqcount_begin.clone.1+0x9f/0xcc
       [<ffffffff8114309d>] generic_perform_write+0xc7/0x1c6
       [<ffffffff810c040e>] ? mark_held_locks+0x59/0x77
       [<ffffffff811445d1>] __generic_file_write_iter+0x17f/0x1c5
       [<ffffffff8120726b>] ext4_file_write_iter+0x2a5/0x354
       [<ffffffff81185656>] ? file_start_write+0x2a/0x2c
       [<ffffffff8107bcdb>] ? bad_area_nosemaphore+0x13/0x15
       [<ffffffff811858ce>] new_sync_write+0x8a/0xb2
       [<ffffffff81186e7b>] vfs_write+0xb5/0x14d
       [<ffffffff81186ffb>] SyS_write+0x5c/0x8c
       [<ffffffff816f2529>] system_call_fastpath+0x12/0x17
      Signed-off-by: NDmitry Monakhov <dmonakhov@openvz.org>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      50db71ab
  18. 03 12月, 2014 2 次提交