Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751922AbbHBHvV (ORCPT ); Sun, 2 Aug 2015 03:51:21 -0400 Received: from a.ns.miles-group.at ([95.130.255.143]:65276 "EHLO radon.swed.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751732AbbHBHvT (ORCPT ); Sun, 2 Aug 2015 03:51:19 -0400 Subject: Re: [RFC][PATCH] ecryptfs: Allow only one instance per lower path To: Tyler Hicks References: <1438338190-22518-1-git-send-email-richard@nod.at> <20150802010259.GA19522@boyd> Cc: ecryptfs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel From: Richard Weinberger X-Enigmail-Draft-Status: N1110 Message-ID: <55BDCBF4.1050305@nod.at> Date: Sun, 2 Aug 2015 09:51:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <20150802010259.GA19522@boyd> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2438 Lines: 60 Am 02.08.2015 um 03:03 schrieb Tyler Hicks: > Thanks for the report and for the patch, Richard! > > On 2015-07-31 12:23:10, Richard Weinberger wrote: >> Mounting the same lower path multiple times should not result >> into multiple ecryptfs instances, otherwise ecryptfs gets confused. >> >> A command sequence of: > > An important detail that took me a while to realize is that /tmp should > be tmpfs in order to trigger the warnings below. I was unable to > reproduce the warnings with ext4 as the lower filesystem. Hmm, I saw it with UBIFS found that it triggers with tmpfs too. I gave ext4 a quick try and yes, it behaves differently, I get a EIO upon the second unlink(). >> $ mount -t ecryptfs /tmp/.secret /mnt_a/secret/ >> $ mount -t ecryptfs /tmp/.secret /mnt_b/secret/ >> $ mkdir -p /mnt_a/secret/xxx >> $ mkdir -p /mnt_b/secret/xxx > > Note that the -p option is covering up the fact that /mnt_b/secret/xxx > already exists. Remove that option and you should see this error: > > mkdir: cannot create directory ‘/mnt_b/secret/xxx’: File exists > > This really isn't important other than understanding that the second > mkdir it isn't needed. > >> $ echo foo > /mnt_a/secret/xxx/test.txt >> $ echo foo > /mnt_b/secret/xxx/test.txt > > /mnt_b/secret/xxx/test.txt should already exist (it does for me, at > least) so the same file is being written to twice in a row. Again, not > really important other than to know that it isn't needed. > >> $ rm -rf /mnt_a/secret/xxx >> $ rm -rf /mnt_b/secret/xxx > > The /mnt_b/secret/xxx dcache entry is stale here because the underlying > file was removed by the first rm command in the /mnt_a/secret mount. The > lower inode's nlink is 0 at this point and what should be happening > here, I think, is that the eCryptfs dentry should be invalidated and the > eCryptfs inode should be destroyed. > > I think that the proper fix is to catch this condition in > ecryptfs_d_revalidate(). I've started working on coming up with a patch > for that but I'll need some more time to finish and test it. So ecryptfs definitely supports mounting the same lower path multiple times? What is the benefit of that behavior? Thanks, //richard -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/