From: Tony Luck <tony.luck@intel.com>
To: Borislav Petkov <bp@alien8.de>,
"Luck, Tony" <tony.luck@intel.com>,
linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
tglx@linutronix.de, mingo@elte.hu, greg@kroah.com, akpm@l
Subject: Re: [RFC] persistent store (version 3) (part 1 of 2)
Date: Thu, 9 Dec 2010 10:23:32 -0800 [thread overview]
Message-ID: <AANLkTimWT8=fmqbEeb+qXbwsWOmaz5d2_Bsr-=DON7L1@mail.gmail.com> (raw)
In-Reply-To: <20101209131452.GA2260@a1.tnic>
On Thu, Dec 9, 2010 at 5:14 AM, Borislav Petkov <bp@alien8.de> wrote:
>> if (!pstore_writefile(inode, dentry, data, size)) {
>> inode->i_nlink--;
>> mutex_lock(&root->d_inode->i_mutex);
>> d_delete(dentry);
>> dput(dentry);
>> mutex_unlock(&root->d_inode->i_mutex);
>> rc = -ENOSPC;
>> goto fail;
>> }
>
> don't we have to iput() the inode here too if pstore_writefile() fails?
No. d_delete() called iput() for us (passing through
dentry_iput along the way) - so we must not do it again.
This upsets the traditional layout of having the error
recovery part of the function undo all the things that
we did leading up to the error. Pity, because your
version is easier to read.
-Tony
WARNING: multiple messages have this Message-ID (diff)
From: Tony Luck <tony.luck@intel.com>
To: Borislav Petkov <bp@alien8.de>,
"Luck, Tony" <tony.luck@intel.com>,
linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
tglx@linutronix.de, mingo@elte.hu, greg@kroah.com,
akpm@linux-foundation.org, ying.huang@intel.com,
David Miller <davem@davemloft.net>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
Jim Keniston <jkenisto@linux.vnet.ibm.com>,
Kyungmin Park <kmpark@infradead.org>,
Geert Uytterhoeven <geert@linux-m68k.org>
Subject: Re: [RFC] persistent store (version 3) (part 1 of 2)
Date: Thu, 9 Dec 2010 10:23:32 -0800 [thread overview]
Message-ID: <AANLkTimWT8=fmqbEeb+qXbwsWOmaz5d2_Bsr-=DON7L1@mail.gmail.com> (raw)
Message-ID: <20101209182332.Uz0gnVvI2MgRDV1P4i3bZRvzIb9XbJrovn-7O13Z2YY@z> (raw)
In-Reply-To: <20101209131452.GA2260@a1.tnic>
On Thu, Dec 9, 2010 at 5:14 AM, Borislav Petkov <bp@alien8.de> wrote:
>> if (!pstore_writefile(inode, dentry, data, size)) {
>> inode->i_nlink--;
>> mutex_lock(&root->d_inode->i_mutex);
>> d_delete(dentry);
>> dput(dentry);
>> mutex_unlock(&root->d_inode->i_mutex);
>> rc = -ENOSPC;
>> goto fail;
>> }
>
> don't we have to iput() the inode here too if pstore_writefile() fails?
No. d_delete() called iput() for us (passing through
dentry_iput along the way) - so we must not do it again.
This upsets the traditional layout of having the error
recovery part of the function undo all the things that
we did leading up to the error. Pity, because your
version is easier to read.
-Tony
next prev parent reply other threads:[~2010-12-09 18:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-06 18:29 [RFC] persistent store (version 3) (part 1 of 2) Luck, Tony
2010-12-06 18:29 ` Luck, Tony
2010-12-08 6:24 ` Borislav Petkov
2010-12-08 17:12 ` Tony Luck
2010-12-08 17:12 ` Tony Luck
2010-12-08 23:35 ` Luck, Tony
2010-12-09 13:14 ` Borislav Petkov
2010-12-09 18:23 ` Tony Luck [this message]
2010-12-09 18:23 ` Tony Luck
2010-12-09 19:12 ` Luck, Tony
2010-12-09 20:47 ` Borislav Petkov
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='AANLkTimWT8=fmqbEeb+qXbwsWOmaz5d2_Bsr-=DON7L1@mail.gmail.com' \
--to=tony.luck@intel.com \
--cc=akpm@l \
--cc=bp@alien8.de \
--cc=greg@kroah.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.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 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).