From: "Josef 'Jeff' Sipek" <jsipek@cs.sunysb.edu>
To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Cc: akpm@linux-foundation.org, Erez Zadok <ezk@cs.sunysb.edu>,
"Josef 'Jeff' Sipek" <jsipek@cs.sunysb.edu>
Subject: [PATCH 03/16] Unionfs: Retry lookup for different silly-renamed files
Date: Sun, 17 Jun 2007 15:09:10 -0400 [thread overview]
Message-ID: <11821073631675-git-send-email-jsipek@cs.sunysb.edu> (raw)
In-Reply-To: <11821073632989-git-send-email-jsipek@cs.sunysb.edu>
From: Erez Zadok <ezk@cs.sunysb.edu>
When we have to copyup an open-but-unlinked file, we have to give it a
temporary name, similar to NFS's silly-renamed files. So we generate
temporary file names until we find one that doesn't exist, and use it. The
code had a bug where if the silly-renamed file name already existed, Unionfs
would oops upon copyup to that temp name.
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
Signed-off-by: Josef 'Jeff' Sipek <jsipek@cs.sunysb.edu>
---
fs/unionfs/commonfops.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c
index 89a236b..28635d8 100644
--- a/fs/unionfs/commonfops.c
+++ b/fs/unionfs/commonfops.c
@@ -42,6 +42,7 @@ static int copyup_deleted_file(struct file *file, struct dentry *dentry,
sprintf(name, ".unionfs%*.*lx",
i_inosize, i_inosize, hidden_dentry->d_inode->i_ino);
+retry:
/*
* Loop, looking for an unused temp name to copyup to.
*
@@ -68,13 +69,14 @@ static int copyup_deleted_file(struct file *file, struct dentry *dentry,
err = PTR_ERR(tmp_dentry);
goto out;
}
- /* don't dput here because of do-while condition eval order */
} while (tmp_dentry->d_inode != NULL); /* need negative dentry */
dput(tmp_dentry);
err = copyup_named_file(dentry->d_parent->d_inode, file, name, bstart,
bindex, file->f_dentry->d_inode->i_size);
- if (err)
+ if (err == -EEXIST)
+ goto retry;
+ else if (err)
goto out;
/* bring it to the same state as an unlinked file */
--
1.5.2.rc1.165.gaf9b
next prev parent reply other threads:[~2007-06-17 19:13 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-17 19:09 [GIT PULL -mm] Unionfs cleanups, fixes, and mmap Josef 'Jeff' Sipek
2007-06-17 19:09 ` [PATCH 01/16] [PATCH] unionfs section mismatch Josef 'Jeff' Sipek
2007-06-17 19:09 ` [PATCH 02/16] Unionfs: Don't revalidate dropped dentries Josef 'Jeff' Sipek
2007-06-17 19:09 ` Josef 'Jeff' Sipek [this message]
2007-06-17 19:09 ` [PATCH 04/16] Unionfs: Set lower inodes correctly after branch management succeeds Josef 'Jeff' Sipek
2007-06-17 19:09 ` [PATCH 05/16] Unionfs: call statfs on lower file system properly Josef 'Jeff' Sipek
2007-06-17 19:09 ` [PATCH 06/16] MAINTAINERS: Add Erez Zadok as a maintainer of Unionfs Josef 'Jeff' Sipek
2007-06-17 19:09 ` [PATCH 07/16] Unionfs: Add standard copyright comment to include/linux/union_fs.h Josef 'Jeff' Sipek
2007-06-17 19:09 ` [PATCH 08/16] Unionfs: Remove unnecessary #define Josef 'Jeff' Sipek
2007-06-17 19:09 ` [PATCH 09/16] Unionfs: mmap implementation Josef 'Jeff' Sipek
2007-06-17 19:09 ` [PATCH 10/16] Unionfs: merge find_new_branch_index and branch_id_to_idx into one function Josef 'Jeff' Sipek
2007-06-17 19:09 ` [PATCH 11/16] Unionfs: Revalidate dentries passed to all inode/super operations Josef 'Jeff' Sipek
2007-06-17 19:09 ` [PATCH 12/16] Unionfs: Cleanup new_dentry_private_data Josef 'Jeff' Sipek
2007-06-17 19:09 ` [PATCH 13/16] Unionfs: Change free_dentry_private_info to take a struct dentry Josef 'Jeff' Sipek
2007-06-17 19:09 ` [PATCH 14/16] Unionfs: Add BUG_ONs to unionfs_lower_* Josef 'Jeff' Sipek
2007-06-17 19:09 ` [PATCH 15/16] Unionfs: Change the semantics of sb info's rwsem Josef 'Jeff' Sipek
2007-06-17 19:09 ` [PATCH 16/16] Unionfs: Remove superfluous check for NULL pointer Josef 'Jeff' Sipek
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=11821073631675-git-send-email-jsipek@cs.sunysb.edu \
--to=jsipek@cs.sunysb.edu \
--cc=akpm@linux-foundation.org \
--cc=ezk@cs.sunysb.edu \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®