From 496ad9aa8ef448058e36ca7a787c61f2e63f0f54 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Wed, 23 Jan 2013 17:07:38 -0500 Subject: new helper: file_inode(file) Signed-off-by: Al Viro --- fs/udf/dir.c | 2 +- fs/udf/file.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'fs/udf') diff --git a/fs/udf/dir.c b/fs/udf/dir.c index eb8bfe2b89a..b3e93f5e17c 100644 --- a/fs/udf/dir.c +++ b/fs/udf/dir.c @@ -186,7 +186,7 @@ out: static int udf_readdir(struct file *filp, void *dirent, filldir_t filldir) { - struct inode *dir = filp->f_path.dentry->d_inode; + struct inode *dir = file_inode(filp); int result; if (filp->f_pos == 0) { diff --git a/fs/udf/file.c b/fs/udf/file.c index 77b5953eaac..4257a1f5302 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c @@ -139,7 +139,7 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov, { ssize_t retval; struct file *file = iocb->ki_filp; - struct inode *inode = file->f_path.dentry->d_inode; + struct inode *inode = file_inode(file); int err, pos; size_t count = iocb->ki_left; struct udf_inode_info *iinfo = UDF_I(inode); @@ -178,7 +178,7 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov, long udf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { - struct inode *inode = filp->f_dentry->d_inode; + struct inode *inode = file_inode(filp); long old_block, new_block; int result = -EINVAL; -- cgit v1.2.3 From 94e07a7590ae855bae0536c42b3086fadc7c83a8 Mon Sep 17 00:00:00 2001 From: Namjae Jeon Date: Sun, 17 Feb 2013 15:48:11 +0900 Subject: fs: encode_fh: return FILEID_INVALID if invalid fid_type This patch is a follow up on below patch: [PATCH] exportfs: add FILEID_INVALID to indicate invalid fid_type commit: 216b6cbdcbd86b1db0754d58886b466ae31f5a63 Signed-off-by: Namjae Jeon Signed-off-by: Vivek Trivedi Acked-by: Steven Whitehouse Acked-by: Sage Weil Signed-off-by: Al Viro --- fs/udf/namei.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'fs/udf') diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 95fee278ab9..102c072c6bb 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c @@ -1270,10 +1270,10 @@ static int udf_encode_fh(struct inode *inode, __u32 *fh, int *lenp, if (parent && (len < 5)) { *lenp = 5; - return 255; + return FILEID_INVALID; } else if (len < 3) { *lenp = 3; - return 255; + return FILEID_INVALID; } *lenp = 3; -- cgit v1.2.3 From 41735818766c0ec215b9a69591e7eae642061954 Mon Sep 17 00:00:00 2001 From: Zhao Hongjiang Date: Wed, 20 Feb 2013 13:13:55 +1100 Subject: fs: change return values from -EACCES to -EPERM According to SUSv3: [EACCES] Permission denied. An attempt was made to access a file in a way forbidden by its file access permissions. [EPERM] Operation not permitted. An attempt was made to perform an operation limited to processes with appropriate privileges or to the owner of a file or other resource. So -EPERM should be returned if capability checks fails. Strictly speaking this is an API change since the error code user sees is altered. Signed-off-by: Zhao Hongjiang Acked-by: Jan Kara Acked-by: Steven Whitehouse Acked-by: Ian Kent Cc: Al Viro Signed-off-by: Andrew Morton Signed-off-by: Al Viro --- fs/udf/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/udf') diff --git a/fs/udf/file.c b/fs/udf/file.c index 4257a1f5302..29569dd0816 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c @@ -204,7 +204,7 @@ long udf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) goto out; case UDF_RELOCATE_BLOCKS: if (!capable(CAP_SYS_ADMIN)) { - result = -EACCES; + result = -EPERM; goto out; } if (get_user(old_block, (long __user *)arg)) { -- cgit v1.2.3