diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-27 19:23:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-27 19:23:12 -0400 |
commit | 3ae5080f4c2e293229508dabe7c8a90af4e4c460 (patch) | |
tree | 9cb11f26905a82b7fac9d3b8f9d61d58bc5c94b0 /fs/namei.c | |
parent | 2c9e15a011c55ff96b2b8d2b126d1b9a96abba20 (diff) | |
parent | aabb8fdb41128705fd1627f56fdd571e45fdbcdb (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (37 commits)
fs: avoid I_NEW inodes
Merge code for single and multiple-instance mounts
Remove get_init_pts_sb()
Move common mknod_ptmx() calls into caller
Parse mount options just once and copy them to super block
Unroll essentials of do_remount_sb() into devpts
vfs: simple_set_mnt() should return void
fs: move bdev code out of buffer.c
constify dentry_operations: rest
constify dentry_operations: configfs
constify dentry_operations: sysfs
constify dentry_operations: JFS
constify dentry_operations: OCFS2
constify dentry_operations: GFS2
constify dentry_operations: FAT
constify dentry_operations: FUSE
constify dentry_operations: procfs
constify dentry_operations: ecryptfs
constify dentry_operations: CIFS
constify dentry_operations: AFS
...
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/fs/namei.c b/fs/namei.c index 1928197b3874..d040ce11785d 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1489,24 +1489,22 @@ int may_open(struct path *path, int acc_mode, int flag) | |||
1489 | if (!inode) | 1489 | if (!inode) |
1490 | return -ENOENT; | 1490 | return -ENOENT; |
1491 | 1491 | ||
1492 | if (S_ISLNK(inode->i_mode)) | 1492 | switch (inode->i_mode & S_IFMT) { |
1493 | case S_IFLNK: | ||
1493 | return -ELOOP; | 1494 | return -ELOOP; |
1494 | 1495 | case S_IFDIR: | |
1495 | if (S_ISDIR(inode->i_mode) && (acc_mode & MAY_WRITE)) | 1496 | if (acc_mode & MAY_WRITE) |
1496 | return -EISDIR; | 1497 | return -EISDIR; |
1497 | 1498 | break; | |
1498 | /* | 1499 | case S_IFBLK: |
1499 | * FIFO's, sockets and device files are special: they don't | 1500 | case S_IFCHR: |
1500 | * actually live on the filesystem itself, and as such you | ||
1501 | * can write to them even if the filesystem is read-only. | ||
1502 | */ | ||
1503 | if (S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) { | ||
1504 | flag &= ~O_TRUNC; | ||
1505 | } else if (S_ISBLK(inode->i_mode) || S_ISCHR(inode->i_mode)) { | ||
1506 | if (path->mnt->mnt_flags & MNT_NODEV) | 1501 | if (path->mnt->mnt_flags & MNT_NODEV) |
1507 | return -EACCES; | 1502 | return -EACCES; |
1508 | 1503 | /*FALLTHRU*/ | |
1504 | case S_IFIFO: | ||
1505 | case S_IFSOCK: | ||
1509 | flag &= ~O_TRUNC; | 1506 | flag &= ~O_TRUNC; |
1507 | break; | ||
1510 | } | 1508 | } |
1511 | 1509 | ||
1512 | error = inode_permission(inode, acc_mode); | 1510 | error = inode_permission(inode, acc_mode); |