From: Boaz Harrosh <bharrosh@panasas.com>
To: Evgeniy Polyakov <zbr@ioremap.net>
Cc: Avishay Traeger <avishay@gmail.com>,
Jeff Garzik <jeff@garzik.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
open-osd <osd-dev@open-osd.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
James Bottomley <James.Bottomley@HansenPartnership.com>
Subject: Re: [PATCH 5/8] exofs: dir_inode and directory operations
Date: Sun, 15 Mar 2009 20:10:36 +0200 [thread overview]
Message-ID: <49BD449C.8090301@panasas.com> (raw)
In-Reply-To: <4999328B.8000705@panasas.com>
Boaz Harrosh wrote:
> Evgeniy Polyakov wrote:
>> Hi.
>>
>> On Mon, Feb 09, 2009 at 03:24:13PM +0200, Boaz Harrosh (bharrosh@panasas.com) wrote:
>>
<snip>
> <snip>
>>> +
>>> + atomic_inc(&inode->i_count);
>>> +
>>> + ret = exofs_async_op(or, create_done, inode, oi->i_cred);
>>> + if (ret) {
>>> + atomic_dec(&inode->i_count);
>> igrab()/iput()?
>>
>
> Thanks, makes much more sense. Sorry leftovers from 2.6.10
>
It's the same at ext2. I looked at the igrab()/iput() code it does some extra
locks which I'm afraid of at this stage. I'll postpone this to the next (next)
merge window, after I ran with it for a while.
>>> + osd_end_request(or);
>>> + return ERR_PTR(-EIO);
>>> + }
>>> + atomic_inc(&sbi->s_curr_pending);
>>> +
>>> + return inode;
>>> +}
>>> +static int exofs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
>>> +{
>>> + struct inode *inode;
>>> + int err = -EMLINK;
>>> +
>>> + if (dir->i_nlink >= EXOFS_LINK_MAX)
>>> + goto out;
>>> +
>>> + inode_inc_link_count(dir);
>>> +
>>> + inode = exofs_new_inode(dir, S_IFDIR | mode);
>>> + err = PTR_ERR(inode);
>>> + if (IS_ERR(inode))
>>> + goto out_dir;
>>> +
>>> + inode->i_op = &exofs_dir_inode_operations;
>>> + inode->i_fop = &exofs_dir_operations;
>>> + inode->i_mapping->a_ops = &exofs_aops;
>>> +
>>> + inode_inc_link_count(inode);
>>> +
>>> + err = exofs_make_empty(inode, dir);
>>> + if (err)
>>> + goto out_fail;
>>> +
>>> + err = exofs_add_link(dentry, inode);
>>> + if (err)
>>> + goto out_fail;
>>> +
>>> + d_instantiate(dentry, inode);
>>> +out:
>>> + return err;
>>> +
>>> +out_fail:
>>> + inode_dec_link_count(inode);
>>> + inode_dec_link_count(inode);
>> Why two decrements, will it be ok after exofs_make_empty() fail when it
>> was incremented only once?
>>
>
> That's hard to say, I'll investigate it some more.
> Thanks
>
I've put some prints and current code is correct. inode->i_nlink (the target
of inode_dec_link_count()) is 1 after exofs_new_inode() and 2 after
inode_inc_link_count() (Just before exofs_make_empty()). Very confusing, but
exofs_add_link() does not touch inode->i_nlink.
I will be posting a new set tomorrow
Thanks
Boaz
next prev parent reply other threads:[~2009-03-15 18:13 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-09 13:07 [PATCHSET 0/8 version 3] exofs Boaz Harrosh
2009-02-09 13:12 ` [PATCH 1/8] exofs: Kbuild, Headers and osd utils Boaz Harrosh
2009-02-16 4:18 ` FUJITA Tomonori
2009-02-16 8:49 ` Boaz Harrosh
2009-02-16 9:00 ` FUJITA Tomonori
2009-02-16 9:19 ` Boaz Harrosh
2009-02-16 9:27 ` Jeff Garzik
2009-02-16 10:19 ` Boaz Harrosh
2009-02-16 11:05 ` pNFS rant (was Re: [PATCH 1/8] exofs: Kbuild, Headers and osd utils) Jeff Garzik
2009-02-16 12:45 ` Boaz Harrosh
2009-02-16 15:50 ` James Bottomley
2009-02-16 16:27 ` Benny Halevy
2009-02-16 16:23 ` Benny Halevy
2009-02-16 9:38 ` [PATCH 1/8] exofs: Kbuild, Headers and osd utils FUJITA Tomonori
2009-02-16 10:29 ` Boaz Harrosh
2009-02-17 0:20 ` FUJITA Tomonori
2009-02-17 8:10 ` [osd-dev] " Boaz Harrosh
2009-02-27 8:09 ` FUJITA Tomonori
2009-03-01 10:43 ` Boaz Harrosh
2009-02-09 13:18 ` [PATCH 2/8] exofs: file and file_inode operations Boaz Harrosh
2009-02-09 13:20 ` [PATCH 3/8] exofs: symlink_inode and fast_symlink_inode operations Boaz Harrosh
2009-02-09 13:22 ` [PATCH 4/8] exofs: address_space_operations Boaz Harrosh
2009-02-09 13:24 ` [PATCH 5/8] exofs: dir_inode and directory operations Boaz Harrosh
2009-02-15 17:08 ` Evgeniy Polyakov
2009-02-16 9:31 ` Boaz Harrosh
2009-03-15 18:10 ` Boaz Harrosh [this message]
2009-03-15 18:37 ` Evgeniy Polyakov
2009-02-09 13:25 ` [PATCH 6/8] exofs: super_operations and file_system_type Boaz Harrosh
2009-02-15 17:24 ` Evgeniy Polyakov
2009-02-16 9:59 ` Boaz Harrosh
2009-02-09 13:29 ` [PATCH 7/8] exofs: Documentation Boaz Harrosh
2009-02-09 13:31 ` [PATCH 8/8] fs: Add exofs to Kernel build Boaz Harrosh
2009-03-18 17:45 [PATCHSET 0/8 version 4] exofs for kernel 2.6.30 Boaz Harrosh
2009-03-18 18:08 ` [PATCH 5/8] exofs: dir_inode and directory operations Boaz Harrosh
2009-03-31 8:04 ` Andrew Morton
2009-03-31 10:22 ` Boaz Harrosh
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=49BD449C.8090301@panasas.com \
--to=bharrosh@panasas.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=akpm@linux-foundation.org \
--cc=avishay@gmail.com \
--cc=jeff@garzik.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=osd-dev@open-osd.org \
--cc=zbr@ioremap.net \
/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
Powered by JetHome