| To: | linux-fsdevel@xxxxxxxxxxxxxxx |
|---|---|
| Subject: | [PATCH v2 RESEND] fs: return EPERM on immutable inode |
| From: | Eryu Guan <guaneryu@xxxxxxxxx> |
| Date: | Tue, 2 Aug 2016 19:58:28 +0800 |
| Cc: | Eryu Guan <guaneryu@xxxxxxxxx>, Steven Whitehouse <swhiteho@xxxxxxxxxx>, Bob Peterson <rpeterso@xxxxxxxxxx>, Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>, Dave Chinner <david@xxxxxxxxxxxxx>, xfs@xxxxxxxxxxx (supporter:XFS FILESYSTEM), cluster-devel@xxxxxxxxxx (open list:GFS2 FILE SYSTEM), linux-kernel@xxxxxxxxxxxxxxx (open list) |
| Delivered-to: | xfs@xxxxxxxxxxx |
| Dkim-signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=aL3VGbqFF7iaM90WryJeH7ia9mUoiBsTK0njnPToLos=; b=dHSnoI4VbhVDkUAufEZjQEfttk+7evgdL4J/T14pb1mDGAQhr56Cycwcq9a7N8b8J+ GXHPSpqa4qz9/d7ItrcXp4hPFM9N/ndY5oXdQph1IG96B6EF2Fpg5gkGTl/ujlr/Rk6h Hl8CQFR0ucNNzW2aMuZmh9LvIt4tMuEVcN5Mm4RcDB2uOWLjnoxkUikGxrgc8cF+x/Lf A9JcsKgAMNrBFaIUDv/y5JJsp6tYKF5IdmCPsWH9vkLXKF6aP713qqVUrSkHP/tovfNH Pv9XzgT09EnWtCh6iF78XJqPuQrWXeq34aDpLmKIpvtiPCv6dM7uWmGKkIlf5hlOywVx SgyQ== |
In most cases, EPERM is returned on immutable inode, and there're only a
few places returning EACCES. I noticed this when running LTP on
overlayfs, setxattr03 failed due to unexpected EACCES on immutable
inode.
So converting all EACCES to EPERM on immutable inode.
Acked-by: Dave Chinner <dchinner@xxxxxxxxxx>
Signed-off-by: Eryu Guan <guaneryu@xxxxxxxxx>
---
v2:
- update commit log to mention that it's found by running LTP
fs/gfs2/inode.c | 2 +-
fs/namei.c | 2 +-
fs/utimes.c | 3 ++-
fs/xfs/xfs_ioctl.c | 2 +-
4 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index e0621ca..e4da0ec 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -1800,7 +1800,7 @@ int gfs2_permission(struct inode *inode, int mask)
}
if ((mask & MAY_WRITE) && IS_IMMUTABLE(inode))
- error = -EACCES;
+ error = -EPERM;
else
error = generic_permission(inode, mask);
if (gfs2_holder_initialized(&i_gh))
diff --git a/fs/namei.c b/fs/namei.c
index c386a32..adb0414 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -410,7 +410,7 @@ int __inode_permission(struct inode *inode, int mask)
* Nobody gets write access to an immutable file.
*/
if (IS_IMMUTABLE(inode))
- return -EACCES;
+ return -EPERM;
/*
* Updating mtime will likely cause i_uid and i_gid to be
diff --git a/fs/utimes.c b/fs/utimes.c
index 85c40f4..794f5f5 100644
--- a/fs/utimes.c
+++ b/fs/utimes.c
@@ -92,10 +92,11 @@ static int utimes_common(struct path *path, struct timespec
*times)
* then we need to check permissions, because
* inode_change_ok() won't do it.
*/
- error = -EACCES;
+ error = -EPERM;
if (IS_IMMUTABLE(inode))
goto mnt_drop_write_and_out;
+ error = -EACCES;
if (!inode_owner_or_capable(inode)) {
error = inode_permission(inode, MAY_WRITE);
if (error)
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index 9a7c878..3d6820f 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -232,7 +232,7 @@ xfs_open_by_handle(
}
if ((fmode & FMODE_WRITE) && IS_IMMUTABLE(inode)) {
- error = -EACCES;
+ error = -EPERM;
goto out_dput;
}
--
2.7.4
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | ÐÐÐÐÐÑÐÐÐÐ: ÐÐ-223: ÐÑÐÐÑÐÑÐÑÐÐÐ ÑÐÐÐÐÐÐÐÐÑÐÐ ÐÐ ÐÐÐÑÐÐÑÐÐÐ ÐÐÑÑÐÐÑÐÐÑÑÐ. ÐÐÐÐÑÐÑÐ ÐÐÐÐÐÐÑÑ Ð ÐÑÐÐÑÐÐÐ 223-ÐÐ, ÑÐÐÐÑÑÐÐÐÑÐ ÑÐÑÐÐ Ð ÐÑÐÐÑÑÐÐ, Ð ÑÐÐÐÐÑÐÑÐ ÐÑÐÐÐ |
|---|---|
| Next by Date: | Re: [PATCH 08/47] xfs: support btrees with overlapping intervals for keys, Christoph Hellwig |
| Previous by Thread: | ÐÐÐÐÐÑÐÐÐÐ: ÐÐ-223: ÐÑÐÐÑÐÑÐÑÐÐÐ ÑÐÐÐÐÐÐÐÐÑÐÐ ÐÐ ÐÐÐÑÐÐÑÐÐÐ ÐÐÑÑÐÐÑÐÐÑÑÐ. ÐÐÐÐÑÐÑÐ ÐÐÐÐÐÐÑÑ Ð ÐÑÐÐÑÐÐÐ 223-ÐÐ, ÑÐÐÐÑÑÐÐÐÑÐ ÑÐÑÐÐ Ð ÐÑÐÐÑÑÐÐ, Ð ÑÐÐÐÐÑÐÑÐ ÐÑÐÐÐ |
| Next by Thread: | Re: [PATCH v2 RESEND] fs: return EPERM on immutable inode, Christoph Hellwig |
| Indexes: | [Date] [Thread] [Top] [All Lists] |