public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [LTP/VFS] fcntl SETLEASE fails on ramfs/tmpfs
@ 2008-04-29  3:42 Bryan Wu
  2008-04-29 20:54 ` Andrew Morton
  0 siblings, 1 reply; 14+ messages in thread
From: Bryan Wu @ 2008-04-29  3:42 UTC (permalink / raw)
  To: LKML, Andrew Morton, Linus Torvalds, willy, Al Viro,
	uclinux-dist-devel

Hi folk,

This days I am digging into this LTP bug reported on our Blackfin test
machine, but I think it is general for other system.
https://blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_id=141&tracker_item_id=3743

And I also found Kumar Gala reported this similar bug before.
http://lkml.org/lkml/2007/11/14/388

1, when opening and creating a new on ramfs/tmpfs, the dentry->d_count
will be added one as below:
--
ramfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
{
|_______struct inode * inode = ramfs_get_inode(dir->i_sb, mode, dev);
|_______int error = -ENOSPC;

|_______if (inode) {
|_______|_______if (dir->i_mode & S_ISGID) {
|_______|_______|_______inode->i_gid = dir->i_gid;
|_______|_______|_______if (S_ISDIR(mode))
|_______|_______|_______|_______inode->i_mode |= S_ISGID;
|_______|_______}
|_______|_______d_instantiate(dentry, inode);
|_______|_______dget(dentry);|__/* Extra count - pin the dentry in core */
|_______|_______error = 0;
|_______|_______dir->i_mtime = dir->i_ctime = CURRENT_TIME;
|_______}
|_______return error;
}
--
The dget(dentry) call introduces an extra count, why?
it is the same in tmpfs.

2, when calling  fcntl(fd, F_SETLEASE,F_WRLCK), it will return -EAGAIN
--
|_______if ((arg == F_WRLCK)
|_______    && ((atomic_read(&dentry->d_count) > 1)
|_______|_______|| (atomic_read(&inode->i_count) > 1)))
|_______|_______goto out;
--

because the dentry->d_count will be 2 not 1. I tested ext2 on Blackfin, it is 1.

3, so I guess maybe the dget(dentry) of ramfs_mknod is useless. But
after remove this dget(),
the ramfs can not be mounted as rootfs at all.

Is the bug in generic_setlease() or in the ramfs/tmpfs inode create function?

Of course, simply remove the test '((atomic_read(&dentry->d_count) >
1)' can workaround this issue.

Thanks
Best Regards,
-Bryan Wu

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-05-02 22:26 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-29  3:42 [LTP/VFS] fcntl SETLEASE fails on ramfs/tmpfs Bryan Wu
2008-04-29 20:54 ` Andrew Morton
2008-04-29 21:42   ` J. Bruce Fields
2008-04-29 22:01     ` Mike Frysinger
2008-04-29 22:11       ` J. Bruce Fields
2008-04-29 22:15         ` Mike Frysinger
2008-04-29 23:21     ` david m. richter
2008-04-30 17:50       ` J. Bruce Fields
2008-04-30 18:14         ` david m. richter
2008-05-01  6:24     ` Al Viro
2008-05-02 22:22       ` J. Bruce Fields
2008-04-29 22:21   ` Matthew Wilcox
2008-05-01  6:33     ` Al Viro
2008-05-02 22:26       ` J. Bruce Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox