Re: [PATCH 5/8] exofs: dir_inode and directory operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Boaz Harrosh wrote:
> Evgeniy Polyakov wrote:
>> Hi.
>>
>> On Mon, Feb 09, 2009 at 03:24:13PM +0200, Boaz Harrosh (bharrosh@xxxxxxxxxxx) 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

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux