diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 21d797ccccd0..85af4694d676 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -1140,6 +1140,12 @@ int ocfs2_setattr(struct mnt_idmap *idmap, struct dentry *dentry, if (S_ISLNK(inode->i_mode)) attr->ia_valid &= ~ATTR_SIZE; + if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) { + status = -EROFS; + mlog_errno(status); + goto bail; + } + #define OCFS2_VALID_ATTRS (ATTR_ATIME | ATTR_MTIME | ATTR_CTIME | ATTR_SIZE \ | ATTR_GID | ATTR_UID | ATTR_MODE) if (!(attr->ia_valid & OCFS2_VALID_ATTRS))