Skip to contentSkip to conversation

Cleanup explicit check for mandatory locks

PATCH In review Pavel Emelyanov 2 participants 2 messages Sep 17, 2007 9P file system

lore
Share & tools
lore
#0 lore raw

PATCH 3/5 Cleanup explicit check for mandatory locks

The __mandatory_lock(inode) macro makes the same check, but makes the code more readable.

Cc Eric Van Hensbergen <[email protected]>
Cc Ron Minnich <[email protected]>
Cc Latchesar Ionkov <[email protected]>

---

 fs/9p/vfs_file.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
fs/9p/vfs_file.c +1 -1
index 2a40c29..7166916 100644
@@ -105,7 +105,7 @@ static int v9fs_file_lock(struct file *f
 	P9_DPRINTK(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl);
 
 	/* No mandatory locks */
-	if ((inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
+	if (__mandatory_lock(inode))
 		return -ENOLCK;
 
 	if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) {
#1 lore raw
Quoted 26 lines · Pavel Emelyanov

The __mandatory_lock(inode) macro makes the same check, but makes the code more readable.

---

 fs/9p/vfs_file.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
fs/9p/vfs_file.c +1 -1
index 2a40c29..7166916 100644
@@ -105,7 +105,7 @@ static int v9fs_file_lock(struct file *f
        P9_DPRINTK(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl);
 
        /* No mandatory locks */
-       if ((inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
+       if (__mandatory_lock(inode))
                return -ENOLCK;
 
        if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) {