[Devel] [PATCH RHEL9 COMMIT] Revert "fs: Allow to remove swapfile hardlinks (for ploop images protection)"

Konstantin Khorenko khorenko at virtuozzo.com
Mon Dec 27 14:48:36 MSK 2021


The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-4.vz9.10.37
------>
commit b9ff4b2a9bbdee7f85738dc63a6d877aa4991fbd
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Mon Dec 27 14:47:22 2021 +0300

    Revert "fs: Allow to remove swapfile hardlinks (for ploop images protection)"
    
    This reverts commit a68808c3a6f6e5d246cdce522396790bf4cee9f4.
    
    Currently we don't use S_SWAPFILE for ploop images protection,
    so let's drop the patch until we really need it.
    
    https://jira.sw.ru/browse/PSBM-25310
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 fs/namei.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 38f52c172619..47c0fe382a51 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2809,8 +2809,7 @@ static int may_delete(struct user_namespace *mnt_userns, struct inode *dir,
 
 	if (check_sticky(mnt_userns, dir, inode) || IS_APPEND(inode) ||
 	    IS_IMMUTABLE(inode) || IS_SWAPFILE(inode) ||
-	    HAS_UNMAPPED_ID(mnt_userns, inode) ||
-	    (IS_SWAPFILE(inode) && inode->i_nlink == 1))
+	    HAS_UNMAPPED_ID(mnt_userns, inode))
 		return -EPERM;
 	if (isdir) {
 		if (!d_is_dir(victim))


More information about the Devel mailing list