[Devel] [PATCH RHEL7 COMMIT] mm/bc: Port diff-bc-shmem-fix-accounting-on-error-path

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jun 5 02:22:13 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.9
------>
commit 928b602c5761aa9302d72ce293c14d596e2977b9
Author: Vladimir Davydov <vdavydov at parallels.com>
Date:   Fri Jun 5 13:22:13 2015 +0400

    mm/bc: Port diff-bc-shmem-fix-accounting-on-error-path
    
    Author: Konstantin Khlebnikov
    Email: khlebnikov at openvz.org
    Subject: ubc: fix shmem accounting on error path
    Date: Thu, 12 Sep 2013 17:26:03 +0400
    
    shmem inode holds memory precharge and releases it in shmem_delete_inode().
    Thus we shouldn't uncharge that precharge after inode creation if in following
    alloc_file hits into kmemsize memory limit.
    
    https://jira.sw.ru/browse/PSBM-22198
    
    Signed-off-by: Konstantin Khlebnikov <khlebnikov at openvz.org>
    
    =============================================================================
    
    Related to https://jira.sw.ru/browse/PSBM-33637
    
    Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
 mm/shmem.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index e13ab4c..88e070a 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2921,16 +2921,16 @@ static struct file *__shmem_file_setup(const char *name, loff_t size,
 	this.len = strlen(name);
 	this.hash = 0; /* will go */
 	sb = shm_mnt->mnt_sb;
+	path.mnt = mntget(shm_mnt);
 	path.dentry = d_alloc_pseudo(sb, &this);
 	if (!path.dentry)
 		goto put_memory;
 	d_set_d_op(path.dentry, &anon_ops);
-	path.mnt = mntget(shm_mnt);
 
 	res = ERR_PTR(-ENOSPC);
 	inode = shmem_get_inode(sb, NULL, S_IFREG | S_IRWXUGO, 0, flags);
 	if (!inode)
-		goto put_dentry;
+		goto put_memory;
 
 	inode->i_flags |= i_flags;
 	d_instantiate(path.dentry, inode);
@@ -2947,10 +2947,10 @@ static struct file *__shmem_file_setup(const char *name, loff_t size,
 
 	return res;
 
-put_dentry:
-	path_put(&path);
 put_memory:
 	shmem_unacct_size(flags, size, get_exec_ub());
+put_dentry:
+	path_put(&path);
 	return res;
 }
 



More information about the Devel mailing list