android_kernel_samsung_univ.../fs/ext4
Tahsin Erdogan 0683564edc ext4: inplace xattr block update fails to deduplicate blocks
commit ec00022030da5761518476096626338bd67df57a upstream.

When an xattr block has a single reference, block is updated inplace
and it is reinserted to the cache. Later, a cache lookup is performed
to see whether an existing block has the same contents. This cache
lookup will most of the time return the just inserted entry so
deduplication is not achieved.

Running the following test script will produce two xattr blocks which
can be observed in "File ACL: " line of debugfs output:

  mke2fs -b 1024 -I 128 -F -O extent /dev/sdb 1G
  mount /dev/sdb /mnt/sdb

  touch /mnt/sdb/{x,y}

  setfattr -n user.1 -v aaa /mnt/sdb/x
  setfattr -n user.2 -v bbb /mnt/sdb/x

  setfattr -n user.1 -v aaa /mnt/sdb/y
  setfattr -n user.2 -v bbb /mnt/sdb/y

  debugfs -R 'stat x' /dev/sdb | cat
  debugfs -R 'stat y' /dev/sdb | cat

This patch defers the reinsertion to the cache so that we can locate
other blocks with the same contents.

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-18 11:17:52 +01:00
..
acl.c ext4: Don't clear SGID when inheriting ACLs 2017-10-12 11:27:35 +02:00
acl.h
balloc.c
bitmap.c
block_validity.c
crypto_fname.c fscrypt: avoid collisions when presenting long encrypted filenames 2017-05-25 14:30:11 +02:00
crypto_key.c fscrypt: lock mutex before checking for bounce page pool 2017-11-30 08:37:25 +00:00
crypto_policy.c fscrypt: fix context consistency check when key(s) unavailable 2017-05-25 14:30:11 +02:00
crypto.c ext4 crypto: don't let data integrity writebacks fail with ENOMEM 2017-05-25 14:30:11 +02:00
dir.c ext4 crypto: revalidate dentry after adding or removing the key 2017-05-08 07:46:02 +02:00
ext4_crypto.h
ext4_extents.h
ext4_jbd2.c
ext4_jbd2.h
ext4.h ext4 crypto: don't let data integrity writebacks fail with ENOMEM 2017-05-25 14:30:11 +02:00
extents_status.c
extents_status.h
extents.c ext4: fix fdatasync(2) after fallocate(2) operation 2017-12-20 10:04:52 +01:00
file.c ext4: in ext4_seek_{hole,data}, return -ENXIO for negative offsets 2017-10-18 09:20:40 +02:00
fsync.c
hash.c
ialloc.c
indirect.c
inline.c
inode.c don't put symlink bodies in pagecache into highmem 2018-02-16 20:09:38 +01:00
ioctl.c
Kconfig
Makefile
mballoc.c ext4: fix stripe-unaligned allocations 2017-11-08 10:06:29 +01:00
mballoc.h
migrate.c
mmp.c
move_extent.c fs: add i_blocksize() 2017-06-14 13:16:24 +02:00
namei.c don't put symlink bodies in pagecache into highmem 2018-02-16 20:09:38 +01:00
page-io.c ext4 crypto: fix some error handling 2017-05-25 14:30:11 +02:00
readpage.c ext4 crypto: don't let data integrity writebacks fail with ENOMEM 2017-05-25 14:30:11 +02:00
resize.c ext4: fix overflow caused by missing cast in ext4_resize_fs() 2017-08-11 09:08:48 -07:00
super.c ext4: save error to disk in __ext4_grp_locked_error() 2018-02-22 15:45:00 +01:00
symlink.c don't put symlink bodies in pagecache into highmem 2018-02-16 20:09:38 +01:00
sysfs.c ext4: check return value of kstrtoull correctly in reserved_clusters_store 2017-07-15 11:57:50 +02:00
truncate.h
xattr_security.c
xattr_trusted.c
xattr_user.c
xattr.c ext4: inplace xattr block update fails to deduplicate blocks 2018-03-18 11:17:52 +01:00
xattr.h