From fd1062ce4cb8359115b00071401d8099b07b3ef6 Mon Sep 17 00:00:00 2001 From: Jaakko Heinonen Date: Wed, 18 Apr 2012 15:22:08 +0000 Subject: [PATCH] Return EOPNOTSUPP rather than EPERM for the SF_SNAPSHOT flag because tmpfs doesn't support snapshots. Suggested by: bde --- sys/fs/tmpfs/tmpfs_subr.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 1a0de177c426..9395824c5bac 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -1080,7 +1080,7 @@ tmpfs_chflags(struct vnode *vp, int flags, struct ucred *cred, struct thread *p) if ((flags & ~(UF_NODUMP | UF_IMMUTABLE | UF_APPEND | UF_OPAQUE | UF_NOUNLINK | SF_ARCHIVED | SF_IMMUTABLE | SF_APPEND | - SF_NOUNLINK | SF_SNAPSHOT)) != 0) + SF_NOUNLINK)) != 0) return (EOPNOTSUPP); /* Disallow this operation if the file system is mounted read-only. */ @@ -1104,9 +1104,6 @@ tmpfs_chflags(struct vnode *vp, int flags, struct ucred *cred, struct thread *p) if (error) return (error); } - /* The snapshot flag cannot be toggled. */ - if ((flags ^ node->tn_flags) & SF_SNAPSHOT) - return (EPERM); } else { if (node->tn_flags & (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) ||