Nano dev Fs

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

 



Hi all,

I'm looking at the nano dev fs code because I find it very simple and I think it's a good start for writing file systems. But I think I've found a bug. I'm posting this to kernel newbies mailing list because I know Greg KH comes here.
Well, it's in the mknod function :


static int mknod(struct inode *dir, struct dentry *dentry,
		int mode, dev_t dev)
{
	struct inode *inode = get_inode(dir->i_sb, mode, dev);
 	int error = -EPERM;

 	if (dentry->d_inode)
 		return -EEXIST;

	.......
}

Shouldn't it be :

static int mknod(struct inode *dir, struct dentry *dentry,
		int mode, dev_t dev)
{
	struct inode *inode;
 	int error = -EPERM;

 	if (dentry->d_inode)
 		return -EEXIST;

	inode = get_inode(dir->i_sb, mode, dev);
	.......
}

Because if the dentry has already an inode, a new inode is allocated for nothing.

Am I missing something ?


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux