mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleg Drokin <oleg.drokin@intel.com>
To: NeilBrown <neilb@suse.com>
Cc: Al Viro <viro@ZenIV.linux.org.uk>,
	Greg Kroah-Hartman <greg@kroah.com>,
	Andreas Dilger <andreas.dilger@intel.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Lustre Development List <lustre-devel@lists.lustre.org>
Subject: Re: [PATCH 03/12] staging: lustre: llite: fix various issues with ll_splice_alias.
Date: Wed, 19 Jul 2017 02:18:39 -0400	[thread overview]
Message-ID: <244467F8-2775-4014-90FF-9CBC74F76B38@intel.com> (raw)
In-Reply-To: <87o9shxcyq.fsf@notabene.neil.brown.name>


On Jul 19, 2017, at 12:33 AM, NeilBrown wrote:

> On Tue, Jul 18 2017, Oleg Drokin wrote:
> 
>> Unfortunately this patch causes insta-crash on first stat call after mount.
>> Sorry, I cannot dig into this deeper right this moment, but I will a bit later.
> 
> V.strange.  The crash suggests that the lock, and hence the inode, is
> not initialized.  I cannot see how that might happen.
> though...
> 
>>> +		spin_lock(&lli->lli_lock);
>>> +		new = ll_find_invalid_alias(inode, de);
>>> +		if (!new)
>>> +			d_add(de, inode);
>>> +		spin_lock(&lli->lli_lock);
> 
> Had it not crashed, it would have deadlocked.  That second spin_lock()
> should be spin_unlock() :-( I don't *think* that would have caused this crash…

No, that's not it.
-	d_add(de, inode);
-	CDEBUG(D_DENTRY, "Add dentry %p inode %p refc %d flags %#x\n",
-	       de, d_inode(de), d_count(de), de->d_flags);
+	de = d_splice_alias(inode, de);
+	if (!IS_ERR(de))
+		CDEBUG(D_DENTRY, "Add dentry %p inode %p refc %d flags %#x\n",
+		       de, d_inode(de), d_count(de), de->d_flags);
	return de;

This is likely it.
d_splice_alias would return NULL if there's no alias, after d_add of the de.
But ll_splice_alias callers expect either an ERR_PTR on error or dentry to use
otherwise.
So in ll_lookup_it_finish() we have:
        alias = ll_splice_alias(inode, *de);
        if (IS_ERR(alias)) {
                rc = PTR_ERR(alias);
                goto out;
        }
        *de = alias;
…
                if (md_revalidate_lock(ll_i2mdexp(parent), &parent_it, &fid,
                                       NULL)) {
===>>> whoops!          d_lustre_revalidate(*de);
                        ll_intent_release(&parent_it);
                }

>> I am adding Al that we discussed this code at some length and he found no problems
>> here, so I am a bit surprised by your findings.
> I'd be very happy to read Al's thoughts.

Some of the discussions were in lkml under subject of "More parallel
atomic_open/d_splice_alias fun with NFS and possibly more FSes"
in July 2016, in between nfs stuff.
There was more but I cannot readily find it.

>> Also the reason we reinvent the d_splice_alias is because we need to
>> splice not just directories, but also regular files.
> 
> I see that.  A key simplification I bring is that directories and
> non-directories can be handled separately.  d_splice_alias() does
> all we need for directories, and nothing useful for non-dirs.

I see.
I still need to  think some more about this whole thing.

Please see commit 99f1c013194e64d4b67d5d318148303b0e1585e1 for double d_add
of the same dentry fix.6

      reply	other threads:[~2017-07-19  6:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-18 23:26 [PATCH 00/12] Assorted lustre fixes and improvements NeilBrown
2017-07-18 23:26 ` [PATCH 12/12] staging: lustre: ldlm: remove unused field 'fwd_generation' NeilBrown
2017-07-18 23:26 ` [PATCH 11/12] staging: lustre: ldlm: remove unnecessary 'ownlocks' variable NeilBrown
2017-07-18 23:26 ` [PATCH 06/12] staging: lustre: ldlm: remove unneeded 'err' arg to ldlm_process_flock_lock() NeilBrown
2017-07-18 23:26 ` [PATCH 08/12] staging: lustre: ldlm: remove unused 'overlaps' variable NeilBrown
2017-07-18 23:26 ` [PATCH 07/12] staging: lustre: ldlm: remove 'flags' arg from ldlm_process_flock_lock() NeilBrown
2017-07-18 23:26 ` [PATCH 10/12] staging: lustre: ldlm: tidy list walking in ldlm_flock() NeilBrown
     [not found]   ` <BN6PR1101MB2132359E48C9904D3E305EE7CBA60@BN6PR1101MB2132.namprd11.prod.outlook.com>
2017-07-19  4:36     ` [lustre-devel] " NeilBrown
2017-07-18 23:26 ` [PATCH 05/12] staging: lustre: ldlm: remove unused 'work_list' arg from ldlm_process_flock_lock() NeilBrown
2017-07-18 23:26 ` [PATCH 02/12] staging: lustre: llite: fix incorrect DCACHE_DISCONNECTED test NeilBrown
2017-07-18 23:26 ` [PATCH 04/12] staging: lustre: ldlm: remove 'first_enq' arg from ldlm_process_flock_lock() NeilBrown
2017-07-18 23:26 ` [PATCH 09/12] staging: lustre: ldlm: remove 'flags' arg from ldlm_flock_destroy() NeilBrown
2017-07-18 23:26 ` [PATCH 01/12] staging: lustre: fix minor typos in comments NeilBrown
2017-07-19  8:29   ` Greg KH
2017-08-02  3:26     ` [PATCH] " NeilBrown
2017-08-03 17:29       ` [lustre-devel] " James Simmons
2017-07-18 23:26 ` [PATCH 03/12] staging: lustre: llite: fix various issues with ll_splice_alias NeilBrown
2017-07-19  2:51   ` Oleg Drokin
2017-07-19  4:33     ` NeilBrown
2017-07-19  6:18       ` Oleg Drokin [this message]

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=244467F8-2775-4014-90FF-9CBC74F76B38@intel.com \
    --to=oleg.drokin@intel.com \
    --cc=andreas.dilger@intel.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lustre-devel@lists.lustre.org \
    --cc=neilb@suse.com \
    --cc=viro@ZenIV.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

all inboxes | Powered by JetHome®