[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080916.143140.75515448.ryusuke@osrg.net>
Date: Tue, 16 Sep 2008 14:31:40 +0900 (JST)
From: konishi.ryusuke@....ntt.co.jp
To: penberg@...helsinki.fi
Cc: akpm@...ux-foundation.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 18/27] nilfs2: pathname operations
Hi Pekka!
On Mon, 15 Sep 2008 21:20:23 +0300, "Pekka Enberg" wrote:
> Hi Ryusuke,
>
> On Sun, Sep 14, 2008 at 10:08 PM, Ryusuke Konishi
> <konishi.ryusuke@....ntt.co.jp> wrote:
> > This adds pathname operations, most of which comes from the ext2 file
> > system.
> >
> > Signed-off-by: Ryusuke Konishi <konishi.ryusuke@....ntt.co.jp>
> > +/*
> > + * By the time this is called, we already have created
> > + * the directory cache entry for the new file, but it
> > + * is so far negative - it has no inode.
> > + *
> > + * If the create succeeds, we fill in the inode information
> > + * with d_instantiate().
> > + */
> > +static int nilfs_create(struct inode *dir, struct dentry *dentry, int mode,
> > + struct nameidata *nd)
> > +{
> > + struct inode *inode;
> > + struct nilfs_transaction_info ti;
> > + int err, err2;
> > +
> > + err = nilfs_transaction_begin(dir->i_sb, &ti, 1);
> > + if (err)
> > + return err;
> > + inode = nilfs_new_inode(dir, mode);
> > + err = PTR_ERR(inode);
> > + if (!IS_ERR(inode)) {
> > + inode->i_op = &nilfs_file_inode_operations;
> > + inode->i_fop = &nilfs_file_operations;
> > + inode->i_mapping->a_ops = &nilfs_aops;
> > + mark_inode_dirty(inode);
> > + err = nilfs_add_nondir(dentry, inode);
> > + }
> > + err2 = nilfs_transaction_end(dir->i_sb, !err);
>
> OK, I don't understand this. The only way nilfs_transaction_end() can
> fail is if we have NILFS_TI_SYNC set and we fail to construct the
> segment. But why do we want to construct a segment if we don't commit?
>
> I guess what I'm asking is why don't we have a separate
> nilfs_transaction_abort() function that can't fail for the erroneous
> case to avoid this double error value tracking thing?
>
> Pekka
Yeah, that's quite right. nilfs_transaction_end() should not call
nilfs_construct_segment() in the error case, and this double error
handling seems to be avoidable.
The ``commit'' argument of nilfs_transaction_end() is insufficient
because it does not cancel the commit state.
I'd like to correct these error hanlings by adding
nilfs_transaction_abort() as you told me.
Thank you for the comment.
Regards,
Ryusuke
--
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