Re: [RFC] persistent store (version 3) (part 1 of 2)

From: Tony Luck
Date: Thu Dec 09 2010 - 13:23:38 EST


On Thu, Dec 9, 2010 at 5:14 AM, Borislav Petkov <bp@xxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/