lkml.org 
[lkml]   [2008]   [Apr]   [4]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [patch 07/10] vfs: add path_rename()
FromMiklos Szeredi <>
DateFri, 04 Apr 2008 20:04:23 +0200
> > From: Miklos Szeredi <mszeredi@suse.cz>
> > 
> > Introduce path_rename().  Make vfs_rename() static.
> [...]
> > +int path_rename(struct path *old_dir_path, struct dentry *old_dentry,
> > +		struct inode *new_dir, struct dentry *new_dentry)
> > +{
> > +	int error = mnt_want_write(old_dir_path->mnt);
> > +
> > +	if (!error) {
> > +		struct inode *old_dir = old_dir_path->dentry->d_inode;
> > +
> > +		error = vfs_rename(old_dir, old_dentry, new_dir, new_dentry);
> > +		mnt_drop_write(old_dir_path->mnt);
> > +	}
> > +
> > +	return error;
> > +}
> > +EXPORT_SYMBOL(path_rename);
> 
> You're grabbing a want_write ref on the source vfsmount only.  Shouldn't
> path_rename() call mnt_want_write on *both* the source and destination
> vfsmounts?

The source and the destination vfsmounts are always the same.

> If so, do we need to order the locks ala lock_rename()?

These are counters (similar to reference counts), not locks.

Miklos


\
 
 \ /
  Last update: 2008-04-04 20:09    [from the cache]
©2003-2008