diff mbox series

locks: Use inode_is_open_for_write

Message ID 20181211082925.21203-1-nborisov@suse.com (mailing list archive)
State New, archived
Headers show
Series locks: Use inode_is_open_for_write | expand

Commit Message

Nikolay Borisov Dec. 11, 2018, 8:29 a.m. UTC
Use the aptly named function rather than open coding it. No functional
changes.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/locks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jeff Layton Dec. 17, 2018, 12:21 p.m. UTC | #1
On Tue, 2018-12-11 at 10:29 +0200, Nikolay Borisov wrote:
> Use the aptly named function rather than open coding it. No functional
> changes.
> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> ---
>  fs/locks.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/locks.c b/fs/locks.c
> index 2ecb4db8c840..16ea7d89a67d 100644
> --- a/fs/locks.c
> +++ b/fs/locks.c
> @@ -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.
diff mbox series

Patch

diff --git a/fs/locks.c b/fs/locks.c
index 2ecb4db8c840..16ea7d89a67d 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -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) ||