linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Erez Zadok <ezk@cs.sunysb.edu>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	viro@ftp.linux.org.uk, hch@infradead.org,
	Erez Zadok <ezk@cs.sunysb.edu>
Subject: [PATCH 10/12] Unionfs: maintain one-open-file invariant for non-directories
Date: Fri, 25 Apr 2008 18:19:06 -0400	[thread overview]
Message-ID: <12091619533479-git-send-email-ezk@cs.sunysb.edu> (raw)
In-Reply-To: <12091619483888-git-send-email-ezk@cs.sunysb.edu>

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
 fs/unionfs/commonfops.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c
index 2706194..82b0eea 100644
--- a/fs/unionfs/commonfops.c
+++ b/fs/unionfs/commonfops.c
@@ -320,7 +320,9 @@ static int __unionfs_file_revalidate(struct file *file, struct dentry *dentry,
 	 * to refresh things.
 	 */
 	if (d_deleted(dentry) ||
-	    (sbgen <= fgen && dbstart(dentry) == fbstart(file)))
+	    (sbgen <= fgen &&
+	     dbstart(dentry) == fbstart(file) &&
+	     unionfs_lower_file(file)))
 		goto out_may_copyup;
 
 	/* save orig branch ID */
@@ -369,6 +371,8 @@ static int __unionfs_file_revalidate(struct file *file, struct dentry *dentry,
 			unionfs_mntput(sb->s_root,
 				       branch_id_to_idx(sb, orig_brid));
 		}
+		/* regular files have only one open lower file */
+		fbend(file) = fbstart(file);
 	}
 	atomic_set(&UNIONFS_F(file)->generation,
 		   atomic_read(&UNIONFS_I(dentry->d_inode)->generation));
@@ -381,6 +385,9 @@ out_may_copyup:
 		pr_debug("unionfs: do delay copyup of \"%s\"\n",
 			 dentry->d_name.name);
 		err = do_delayed_copyup(file);
+		/* regular files have only one open lower file */
+		if (!err && !S_ISDIR(dentry->d_inode->i_mode))
+			fbend(file) = fbstart(file);
 	}
 
 out:
-- 
1.5.2.2


  parent reply	other threads:[~2008-04-25 22:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-25 22:18 [GIT PULL -mm] 00/12 Unionfs updates/fixes/cleanups Erez Zadok
2008-04-25 22:18 ` [PATCH 01/12] Unionfs: minor code cleanups Erez Zadok
2008-04-25 22:18 ` [PATCH 02/12] Unionfs: prevent races in unionfs_fault Erez Zadok
2008-04-25 22:18 ` [PATCH 03/12] Unionfs: copy lower times in fsync/fasync only when needed Erez Zadok
2008-04-25 22:19 ` [PATCH 04/12] Unionfs: lock inode around calls to notify_change() Erez Zadok
2008-04-25 22:19 ` [PATCH 05/12] Unionfs: stop as soon as first writeable branch is found Erez Zadok
2008-04-25 22:19 ` [PATCH 06/12] Unionfs: don't dereference dentry without lower branches in d_release Erez Zadok
2008-04-25 22:19 ` [PATCH 07/12] Unionfs: set append offset correctly for copied-up files Erez Zadok
2008-04-25 22:19 ` [PATCH 08/12] Unionfs: copyup only if file is being written to Erez Zadok
2008-04-25 22:19 ` [PATCH 09/12] Unionfs: reorganize file_revalidate for un/locking callers Erez Zadok
2008-04-25 22:19 ` Erez Zadok [this message]
2008-04-25 22:19 ` [PATCH 11/12] Unionfs: set lower file to NULL in file_release Erez Zadok
2008-04-25 22:19 ` [PATCH 12/12] Unionfs: lock parent dentry branch config in write Erez Zadok

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12091619533479-git-send-email-ezk@cs.sunysb.edu \
    --to=ezk@cs.sunysb.edu \
    --cc=akpm@linux-foundation.org \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ftp.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).