lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191103094431.GA18576-nikitas.angelinas@gmail.com>
Date:   Sun, 3 Nov 2019 01:44:54 -0800
From:   Nikitas Angelinas <nikitas.angelinas@...il.com>
To:     Andrew Morton <akpm@...ux-foundation.org>, zhengbin@...tro,
        zhengbin13@...wei.com, Jan Kara <jack@...e.cz>
Cc:     Al Viro <viro@...iv.linux.org.uk>, reiserfs-devel@...r.kernel.org,
        linux-kernel@...r.kernel.org, nikitas.angelinas@...il.com
Subject: [PATCH] reiserfs: replace open-coded atomic_dec_and_mutex_lock()

Replace the open-coded logic of atomic_dec_and_mutex_lock() in
reiserfs_file_release().

Signed-off-by: Nikitas Angelinas <nikitas.angelinas@...il.com>
---
 fs/reiserfs/file.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c
index 843aadc..84cf8bd 100644
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -38,16 +38,10 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp)
 
 	BUG_ON(!S_ISREG(inode->i_mode));
 
-        if (atomic_add_unless(&REISERFS_I(inode)->openers, -1, 1))
+	if (!atomic_dec_and_mutex_lock(&REISERFS_I(inode)->openers,
+				       &REISERFS_I(inode)->tailpack))
 		return 0;
 
-	mutex_lock(&REISERFS_I(inode)->tailpack);
-
-        if (!atomic_dec_and_test(&REISERFS_I(inode)->openers)) {
-		mutex_unlock(&REISERFS_I(inode)->tailpack);
-		return 0;
-	}
-
 	/* fast out for when nothing needs to be done */
 	if ((!(REISERFS_I(inode)->i_flags & i_pack_on_close_mask) ||
 	     !tail_has_to_be_packed(inode)) &&
-- 
2.10.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ