[Devel] [PATCH RHEL7 COMMIT] pfcache: abort ext4_pfcache_open if inode already has peer installed

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jun 2 08:06:30 PDT 2016


The commit is pushed to "branch-rh7-3.10.0-327.18.2.vz7.14.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.18.2.vz7.14.10
------>
commit cefaca838039a6d306791a29c9984be56cc6e7f2
Author: Vladimir Davydov <vdavydov at virtuozzo.com>
Date:   Thu Jun 2 19:06:30 2016 +0400

    pfcache: abort ext4_pfcache_open if inode already has peer installed
    
    Calling ioctl(FS_IOC_PFCACHE_OPEN) on an inode that already has a
    pfcache peer installed results in i_peer_list corruption:
    
      WARNING: at lib/list_debug.c:36 __list_add+0x8a/0xc0()
      list_add double add: new=ffff88009c525d40, prev=ffff880088a5bac0, next=ffff88009c525d40.
      CPU: 5 PID: 1429 Comm: pfcached ve: 0 Not tainted 3.10.0-327.18.2.vz7.14.9 #1 14.9
       0000000000000024 0000000085f7231d ffff88008f153c80 ffffffff81632bb7
       ffff88008f153cb8 ffffffff8107b460 ffff88009c525d40 ffff88009c525d40
       ffff880088a5bac0 ffff88009c525cc8 ffff88009c525c90 ffff88008f153d20
      Call Trace:
       [<ffffffff81632bb7>] dump_stack+0x19/0x1b
       [<ffffffff8107b460>] warn_slowpath_common+0x70/0xb0
       [<ffffffff8107b4fc>] warn_slowpath_fmt+0x5c/0x80
       [<ffffffff8130a75a>] __list_add+0x8a/0xc0
       [<ffffffff811a85fc>] open_mapping_peer+0x15c/0x1f0
       [<ffffffffa016e645>] ext4_open_pfcache+0x155/0x1b0 [ext4]
       [<ffffffffa0127e89>] ext4_ioctl+0xa9/0x15f0 [ext4]
       [<ffffffff811ad774>] ? handle_mm_fault+0x5b4/0xf50
       [<ffffffff8120bd5b>] ? do_filp_open+0x4b/0xb0
       [<ffffffff8120de15>] do_vfs_ioctl+0x255/0x4f0
       [<ffffffff8163e9c4>] ? __do_page_fault+0x164/0x450
       [<ffffffff8120e104>] SyS_ioctl+0x54/0xa0
       [<ffffffff816434c9>] system_call_fastpath+0x16/0x1b
    
    https://jira.sw.ru/browse/PSBM-47806
    
    Signed-off-by: Vladimir Davydov <vdavydov at virtuozzo.com>
---
 fs/ext4/pfcache.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/ext4/pfcache.c b/fs/ext4/pfcache.c
index fe1296f..ab2f20c 100644
--- a/fs/ext4/pfcache.c
+++ b/fs/ext4/pfcache.c
@@ -43,6 +43,9 @@ int ext4_open_pfcache(struct inode *inode)
 	struct path root, path;
 	int ret;
 
+	if (inode->i_mapping->i_peer_file)
+		return -EBUSY;
+
 	if (!(ext4_test_inode_state(inode, EXT4_STATE_PFCACHE_CSUM) &&
 	      EXT4_I(inode)->i_data_csum_end < 0))
 		return -ENODATA;


More information about the Devel mailing list