Skip to contentSkip to conversation

vfs: no need to check about IS_IMMUTABLE in do_fallocate

PATCH In review Ashish Sangwan 2 participants 3 messages Apr 27, 2013 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vfs: no need to check about IS_IMMUTABLE in do_fallocate

From: Ashish Sangwan <[email protected]>

In do_fallocate, first there is check for FMODE_WRITE and after that there is second check for IS_IMMUTABLE.
A file cannot be opened in write mode if the corresponding inode is immutable, hence the second check is not required.

---
 fs/open.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
fs/open.c +0 -3
index 8c74100..939e402 100644
@@ -245,9 +245,6 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 	if (mode & FALLOC_FL_PUNCH_HOLE && IS_APPEND(inode))
 		return -EPERM;
 
-	if (IS_IMMUTABLE(inode))
-		return -EPERM;
-
 	/*
 	 * Revalidate the write permissions, in case security policy has
 	 * changed since the files were opened.
Signature · 1 line
1.7.8.4
#1 lore raw

Il 27/04/2013 06:42, Ashish Sangwan ha scritto:

Quoted 9 lines

From: Ashish Sangwan <[email protected]>

In do_fallocate, first there is check for FMODE_WRITE and after that there is second check for IS_IMMUTABLE.
A file cannot be opened in write mode if the corresponding inode is immutable, hence the second check is not required.

See commit 1ca551c6caae7b52178555cdedea6ca26444be46.

Regards,

Marco

#2 lore raw
Quoted 9 lines · Marco Stornelli

Il 27/04/2013 06:42, Ashish Sangwan ha scritto:

Quoted 7 lines

From: Ashish Sangwan <[email protected]>

In do_fallocate, first there is check for FMODE_WRITE and after that there is second check for IS_IMMUTABLE.
A file cannot be opened in write mode if the corresponding inode is immutable, hence the second check is not required.

Quoted 5 lines
Quoted 2 lines

See commit 1ca551c6caae7b52178555cdedea6ca26444be46.

Got it,
Thanks,
Ashish

Quoted 4 lines

Regards,

Marco