]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/suse-2.6.27.31/patches.suse/fs-knows-MAY_APPEND.diff
Add a patch to fix Intel E100 wake-on-lan problems.
[ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.suse / fs-knows-MAY_APPEND.diff
1 From: Andreas Gruenbacher <agruen@suse.de>
2 Subject: Allow filesystems to handle MAY_APPEND
3
4 The MS_WITHAPPEND super_block flag tells the vfs that the permission
5 inode operation understands the MAY_APPEND flag. This is required for
6 implementing permission models which go beyond the traditional UNIX
7 semantics.
8
9 If a filesystem does not set the flag, the behavior is unchanged.
10
11 Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
12
13 ---
14 fs/namei.c | 6 +++++-
15 include/linux/fs.h | 2 ++
16 2 files changed, 7 insertions(+), 1 deletion(-)
17
18 --- a/fs/namei.c
19 +++ b/fs/namei.c
20 @@ -230,6 +230,7 @@ int generic_permission(struct inode *ino
21 int inode_permission(struct inode *inode, int mask)
22 {
23 int retval;
24 + int submask = mask;
25
26 if (mask & MAY_WRITE) {
27 umode_t mode = inode->i_mode;
28 @@ -248,9 +249,12 @@ int inode_permission(struct inode *inode
29 return -EACCES;
30 }
31
32 + if (!IS_WITHAPPEND(inode))
33 + submask &= ~MAY_APPEND;
34 +
35 /* Ordinary permission routines do not understand MAY_APPEND. */
36 if (inode->i_op && inode->i_op->permission) {
37 - retval = inode->i_op->permission(inode, mask);
38 + retval = inode->i_op->permission(inode, submask);
39 if (!retval) {
40 /*
41 * Exec permission on a regular file is denied if none
42 --- a/include/linux/fs.h
43 +++ b/include/linux/fs.h
44 @@ -133,6 +133,7 @@ extern int dir_notify_enable;
45 #define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */
46 #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
47 #define MS_I_VERSION (1<<23) /* Update inode I_version field */
48 +#define MS_WITHAPPEND (1<<24) /* iop->permission() understands MAY_APPEND */
49 #define MS_ACTIVE (1<<30)
50 #define MS_NOUSER (1<<31)
51
52 @@ -183,6 +184,7 @@ extern int dir_notify_enable;
53 #define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK)
54 #define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME)
55 #define IS_I_VERSION(inode) __IS_FLG(inode, MS_I_VERSION)
56 +#define IS_WITHAPPEND(inode) __IS_FLG(inode, MS_WITHAPPEND)
57
58 #define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA)
59 #define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)