From: Oleg Drokin <green@namesys.com>
To: Bernd Schubert <bernd-schubert@web.de>, reiserfs@nn7.de
Cc: reiserfs-list@namesys.com
Subject: Re: nfsd-fh: found a name that I didn't expect
Date: Mon, 31 Mar 2003 14:24:06 +0400 [thread overview]
Message-ID: <20030331142406.Q25533@namesys.com> (raw)
In-Reply-To: <200303301708.11703.bernd-schubert@web.de>
Hello!
On Sun, Mar 30, 2003 at 04:08:11PM +0100, Bernd Schubert wrote:
> Anyway I also tested the kernel-patch, but it causes problems with mounts from
> another nfs-server. Well, mounting works fine, but e.g. running 'ls
Ah, stupid me.
I have another patch that we created before iget5_locked backport.
It's a bit of hack to beat the race, but it works (fixes the race).
It does not touch any code outside of reiserfs.
So if you apply that to 2.4.20 and see if you still can see the NFS problem
over time...
Patch is below.
Bye,
Oleg
===== fs/reiserfs/inode.c 1.42 vs edited =====
--- 1.42/fs/reiserfs/inode.c Thu Feb 13 15:42:42 2003
+++ edited/fs/reiserfs/inode.c Thu Feb 20 17:23:24 2003
@@ -20,6 +20,10 @@
static int reiserfs_get_block (struct inode * inode, long block,
struct buffer_head * bh_result, int create);
+/* This spinlock guards inode pkey in private part of inode
+ against race between find_actor() vs reiserfs_read_inode2 */
+static spinlock_t keycopy_lock = SPIN_LOCK_UNLOCKED;
+
void reiserfs_delete_inode (struct inode * inode)
{
int jbegin_count = JOURNAL_PER_BALANCE_CNT * 2;
@@ -898,8 +902,9 @@
bh = PATH_PLAST_BUFFER (path);
ih = PATH_PITEM_HEAD (path);
-
+ spin_lock(&keycopy_lock);
copy_key (INODE_PKEY (inode), &(ih->ih_key));
+ spin_unlock(&keycopy_lock);
inode->i_blksize = PAGE_SIZE;
INIT_LIST_HEAD(&inode->u.reiserfs_i.i_prealloc_list) ;
@@ -1220,10 +1225,27 @@
unsigned long inode_no, void *opaque )
{
struct reiserfs_iget4_args *args;
+ int retval;
args = opaque;
+ /* We protect against possible parallel init_inode() on another CPU here. */
+ spin_lock(&keycopy_lock);
/* args is already in CPU order */
- return le32_to_cpu(INODE_PKEY(inode)->k_dir_id) == args -> objectid;
+ if (le32_to_cpu(INODE_PKEY(inode)->k_dir_id) == args -> objectid)
+ retval = 1;
+ else
+ /* If The key does not match, lets see if we are racing
+ with another iget4, that already progressed so far
+ to reiserfs_read_inode2() and was preempted in
+ call to search_by_key(). The signs of that are:
+ Inode is locked
+ dirid and object id are zero (not yet initialized)*/
+ retval = (inode->i_state & I_LOCK) &&
+ !INODE_PKEY(inode)->k_dir_id &&
+ !INODE_PKEY(inode)->k_objectid;
+
+ spin_unlock(&keycopy_lock);
+ return retval;
}
struct inode * reiserfs_iget (struct super_block * s, const struct cpu_key * key)
next prev parent reply other threads:[~2003-03-31 10:24 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-28 17:28 nfsd-fh: found a name that I didn't expect Bernd Schubert
2003-03-28 17:28 ` Bernd Schubert
2003-03-29 11:01 ` Oleg Drokin
2003-03-29 11:54 ` Bernd Schubert
2003-03-29 11:59 ` Oleg Drokin
2003-03-29 14:09 ` Bernd Schubert
2003-03-29 14:13 ` Oleg Drokin
2003-03-29 15:06 ` Bernd Schubert
2003-03-29 17:37 ` Oleg Drokin
2003-03-29 18:22 ` Bernd Schubert
2003-03-29 18:45 ` Soeren Sonnenburg
2003-03-31 8:37 ` Oleg Drokin
2003-03-31 8:43 ` Soeren Sonnenburg
2003-03-31 9:05 ` Oleg Drokin
2003-03-30 15:08 ` Bernd Schubert
2003-03-31 8:33 ` Oleg Drokin
2003-03-31 10:24 ` Oleg Drokin [this message]
2003-03-31 10:37 ` Soeren Sonnenburg
2003-03-31 10:41 ` Oleg Drokin
2003-03-31 13:28 ` Soeren Sonnenburg
2003-06-02 15:01 ` Oleg Drokin
2003-03-31 10:49 ` Bernd Schubert
2003-08-06 21:00 ` John Dalbec
2003-08-06 22:06 ` Bernd Schubert
2003-08-07 5:28 ` Oleg Drokin
2003-03-29 12:04 ` Bernd Schubert
[not found] ` <200303291933.48476.roland@xebec.de>
[not found] ` <20030331122820.D25533@namesys.com>
2003-03-31 21:44 ` Roland
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=20030331142406.Q25533@namesys.com \
--to=green@namesys.com \
--cc=bernd-schubert@web.de \
--cc=reiserfs-list@namesys.com \
--cc=reiserfs@nn7.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.