From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jordi Pujol Subject: Re: overlayfs: mounting overlayfs on top of overlayfs Date: Mon, 6 Jun 2011 20:29:24 +0200 Message-ID: <201106062029.25279.jordipujolp@gmail.com> References: <201106031529.30103.jordipujolp@gmail.com> <201106040823.25072.jordipujolp@gmail.com> Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_FyR7N3osqrXnmWE" Cc: linux-fsdevel@vger.kernel.org, Michal Suchanek To: Miklos Szeredi Return-path: Received: from mail-ww0-f44.google.com ([74.125.82.44]:34290 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754019Ab1FFS33 (ORCPT ); Mon, 6 Jun 2011 14:29:29 -0400 Received: by wwa36 with SMTP id 36so4104905wwa.1 for ; Mon, 06 Jun 2011 11:29:28 -0700 (PDT) In-Reply-To: <201106040823.25072.jordipujolp@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: --Boundary-00=_FyR7N3osqrXnmWE Content-Type: Text/Plain; charset="ibm874" Content-Transfer-Encoding: 7bit Hello, The attached patch solves the problem, Thanks, Jordi Pujol Live never ending Tale GNU/Linux Live forever! http://livenet.selfip.com --Boundary-00=_FyR7N3osqrXnmWE Content-Type: text/x-patch; charset="UTF-8"; name="53-mount-on-top-readonly-mount.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="53-mount-on-top-readonly-mount.patch" overlayfs v10: - Test for readonly using the vfsmount superblock from the main filesystem. - Ignore WRITE request for the real filesystems. Signed-off-by: Jordi Pujol --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c 2011-06-05 10:06:25.323823937 +0200 @@ -54,6 +54,9 @@ int ovl_permission(struct inode *inode, bool is_upper; int err; + if (mask & MAY_WRITE && IS_RDONLY(inode)) + return -EROFS; + if (S_ISDIR(inode->i_mode)) { oe = inode->i_private; } else if (flags & IPERM_FLAG_RCU) { @@ -102,6 +105,8 @@ int ovl_permission(struct inode *inode, err = -EACCES; if (IS_IMMUTABLE(realinode)) goto out_dput; + + mask &= ~MAY_WRITE; } if (realinode->i_op->permission) --Boundary-00=_FyR7N3osqrXnmWE--