lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 15 Mar 2009 20:10:36 +0200
From:	Boaz Harrosh <bharrosh@...asas.com>
To:	Evgeniy Polyakov <zbr@...emap.net>
CC:	Avishay Traeger <avishay@...il.com>, Jeff Garzik <jeff@...zik.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-fsdevel <linux-fsdevel@...r.kernel.org>,
	open-osd <osd-dev@...n-osd.org>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	James Bottomley <James.Bottomley@...senPartnership.com>
Subject: Re: [PATCH 5/8] exofs: dir_inode and directory operations

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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ