Skip to contentSkip to conversation

locks: Use inode_is_open_for_write

PATCH In review Nikolay Borisov 2 participants 2 messages Dec 11, 2018 – Dec 17, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 locks: Use inode_is_open_for_write

Use the aptly named function rather than open coding it. No functional changes.

---
 fs/locks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/locks.c +1 -1
index 2ecb4db8c840..16ea7d89a67d 100644
@@ -1646,7 +1646,7 @@ check_conflicting_open(const struct dentry *dentry, const long arg, int flags)
 	if (flags & FL_LAYOUT)
 		return 0;
 
-	if ((arg == F_RDLCK) && (atomic_read(&inode->i_writecount) > 0))
+	if ((arg == F_RDLCK) && inode_is_open_for_write(inode))
 		return -EAGAIN;
 
 	if ((arg == F_WRLCK) && ((d_count(dentry) > 1) ||
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 13 lines · Nikolay Borisov

Use the aptly named function rather than open coding it. No functional changes.

---
 fs/locks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/locks.c +0 -0
index 2ecb4db8c840..16ea7d89a67d 100644

fs/locks.c check_conflicting_open(const struct dentry *dentry, const long arg, int flags) · line 1652

Quoted 8 lines
fs/locks.c +1 -1
@@ -1646,7 +1646,7 @@ check_conflicting_open(const struct dentry *dentry, const long arg, int flags)
 	if (flags & FL_LAYOUT)
 		return 0;
 
-	if ((arg == F_RDLCK) && (atomic_read(&inode->i_writecount) > 0))
+	if ((arg == F_RDLCK) && inode_is_open_for_write(inode))
 		return -EAGAIN;
 
 	if ((arg == F_WRLCK) && ((d_count(dentry) > 1) ||

Thanks, merged into locks-next. This should make v4.21.

Signature · 1 line
Jeff Layton <[email protected]>