Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a11f3a05 authored by Arjan van de Ven's avatar Arjan van de Ven Committed by Linus Torvalds
Browse files

[PATCH] sem2mutex: vfs_rename_mutex



Semaphore to mutex conversion.

The conversion was generated via scripts, and the result was validated
automatically via a script as well.

Signed-off-by: default avatarArjan van de Ven <arjan@infradead.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Cc: Al Viro <viro@ftp.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 144efe3e
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -138,9 +138,9 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
	cifs_sb = CIFS_SB(inode->i_sb);
	cifs_sb = CIFS_SB(inode->i_sb);
	pTcon = cifs_sb->tcon;
	pTcon = cifs_sb->tcon;


	down(&direntry->d_sb->s_vfs_rename_sem);
	mutex_lock(&direntry->d_sb->s_vfs_rename_mutex);
	full_path = build_path_from_dentry(direntry);
	full_path = build_path_from_dentry(direntry);
	up(&direntry->d_sb->s_vfs_rename_sem);
	mutex_unlock(&direntry->d_sb->s_vfs_rename_mutex);
	if(full_path == NULL) {
	if(full_path == NULL) {
		FreeXid(xid);
		FreeXid(xid);
		return -ENOMEM;
		return -ENOMEM;
@@ -317,9 +317,9 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
	cifs_sb = CIFS_SB(inode->i_sb);
	cifs_sb = CIFS_SB(inode->i_sb);
	pTcon = cifs_sb->tcon;
	pTcon = cifs_sb->tcon;


	down(&direntry->d_sb->s_vfs_rename_sem);
	mutex_lock(&direntry->d_sb->s_vfs_rename_mutex);
	full_path = build_path_from_dentry(direntry);
	full_path = build_path_from_dentry(direntry);
	up(&direntry->d_sb->s_vfs_rename_sem);
	mutex_unlock(&direntry->d_sb->s_vfs_rename_mutex);
	if(full_path == NULL)
	if(full_path == NULL)
		rc = -ENOMEM;
		rc = -ENOMEM;
	else if (pTcon->ses->capabilities & CAP_UNIX) {
	else if (pTcon->ses->capabilities & CAP_UNIX) {
+2 −2
Original line number Original line Diff line number Diff line
@@ -86,9 +86,9 @@ int cifs_dir_notify(struct file * file, unsigned long arg)
	cifs_sb = CIFS_SB(file->f_dentry->d_sb);
	cifs_sb = CIFS_SB(file->f_dentry->d_sb);
	pTcon = cifs_sb->tcon;
	pTcon = cifs_sb->tcon;


	down(&file->f_dentry->d_sb->s_vfs_rename_sem);
	mutex_lock(&file->f_dentry->d_sb->s_vfs_rename_mutex);
	full_path = build_path_from_dentry(file->f_dentry);
	full_path = build_path_from_dentry(file->f_dentry);
	up(&file->f_dentry->d_sb->s_vfs_rename_sem);
	mutex_unlock(&file->f_dentry->d_sb->s_vfs_rename_mutex);


	if(full_path == NULL) {
	if(full_path == NULL) {
		rc = -ENOMEM;
		rc = -ENOMEM;
+2 −2
Original line number Original line Diff line number Diff line
@@ -203,9 +203,9 @@ int cifs_open(struct inode *inode, struct file *file)
		}
		}
	}
	}


	down(&inode->i_sb->s_vfs_rename_sem);
	mutex_lock(&inode->i_sb->s_vfs_rename_mutex);
	full_path = build_path_from_dentry(file->f_dentry);
	full_path = build_path_from_dentry(file->f_dentry);
	up(&inode->i_sb->s_vfs_rename_sem);
	mutex_unlock(&inode->i_sb->s_vfs_rename_mutex);
	if (full_path == NULL) {
	if (full_path == NULL) {
		FreeXid(xid);
		FreeXid(xid);
		return -ENOMEM;
		return -ENOMEM;
+8 −8
Original line number Original line Diff line number Diff line
@@ -574,9 +574,9 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)


	/* Unlink can be called from rename so we can not grab the sem here
	/* Unlink can be called from rename so we can not grab the sem here
	   since we deadlock otherwise */
	   since we deadlock otherwise */
/*	down(&direntry->d_sb->s_vfs_rename_sem);*/
/*	mutex_lock(&direntry->d_sb->s_vfs_rename_mutex);*/
	full_path = build_path_from_dentry(direntry);
	full_path = build_path_from_dentry(direntry);
/*	up(&direntry->d_sb->s_vfs_rename_sem);*/
/*	mutex_unlock(&direntry->d_sb->s_vfs_rename_mutex);*/
	if (full_path == NULL) {
	if (full_path == NULL) {
		FreeXid(xid);
		FreeXid(xid);
		return -ENOMEM;
		return -ENOMEM;
@@ -718,9 +718,9 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
	cifs_sb = CIFS_SB(inode->i_sb);
	cifs_sb = CIFS_SB(inode->i_sb);
	pTcon = cifs_sb->tcon;
	pTcon = cifs_sb->tcon;


	down(&inode->i_sb->s_vfs_rename_sem);
	mutex_lock(&inode->i_sb->s_vfs_rename_mutex);
	full_path = build_path_from_dentry(direntry);
	full_path = build_path_from_dentry(direntry);
	up(&inode->i_sb->s_vfs_rename_sem);
	mutex_unlock(&inode->i_sb->s_vfs_rename_mutex);
	if (full_path == NULL) {
	if (full_path == NULL) {
		FreeXid(xid);
		FreeXid(xid);
		return -ENOMEM;
		return -ENOMEM;
@@ -803,9 +803,9 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
	cifs_sb = CIFS_SB(inode->i_sb);
	cifs_sb = CIFS_SB(inode->i_sb);
	pTcon = cifs_sb->tcon;
	pTcon = cifs_sb->tcon;


	down(&inode->i_sb->s_vfs_rename_sem);
	mutex_lock(&inode->i_sb->s_vfs_rename_mutex);
	full_path = build_path_from_dentry(direntry);
	full_path = build_path_from_dentry(direntry);
	up(&inode->i_sb->s_vfs_rename_sem);
	mutex_unlock(&inode->i_sb->s_vfs_rename_mutex);
	if (full_path == NULL) {
	if (full_path == NULL) {
		FreeXid(xid);
		FreeXid(xid);
		return -ENOMEM;
		return -ENOMEM;
@@ -1137,9 +1137,9 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
			rc = 0;
			rc = 0;
	}
	}
		
		
	down(&direntry->d_sb->s_vfs_rename_sem);
	mutex_lock(&direntry->d_sb->s_vfs_rename_mutex);
	full_path = build_path_from_dentry(direntry);
	full_path = build_path_from_dentry(direntry);
	up(&direntry->d_sb->s_vfs_rename_sem);
	mutex_unlock(&direntry->d_sb->s_vfs_rename_mutex);
	if (full_path == NULL) {
	if (full_path == NULL) {
		FreeXid(xid);
		FreeXid(xid);
		return -ENOMEM;
		return -ENOMEM;
+8 −8
Original line number Original line Diff line number Diff line
@@ -48,10 +48,10 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
/* No need to check for cross device links since server will do that
/* No need to check for cross device links since server will do that
   BB note DFS case in future though (when we may have to check) */
   BB note DFS case in future though (when we may have to check) */


	down(&inode->i_sb->s_vfs_rename_sem);
	mutex_lock(&inode->i_sb->s_vfs_rename_mutex);
	fromName = build_path_from_dentry(old_file);
	fromName = build_path_from_dentry(old_file);
	toName = build_path_from_dentry(direntry);
	toName = build_path_from_dentry(direntry);
	up(&inode->i_sb->s_vfs_rename_sem);
	mutex_unlock(&inode->i_sb->s_vfs_rename_mutex);
	if((fromName == NULL) || (toName == NULL)) {
	if((fromName == NULL) || (toName == NULL)) {
		rc = -ENOMEM;
		rc = -ENOMEM;
		goto cifs_hl_exit;
		goto cifs_hl_exit;
@@ -103,9 +103,9 @@ cifs_follow_link(struct dentry *direntry, struct nameidata *nd)


	xid = GetXid();
	xid = GetXid();


	down(&direntry->d_sb->s_vfs_rename_sem);
	mutex_lock(&direntry->d_sb->s_vfs_rename_mutex);
	full_path = build_path_from_dentry(direntry);
	full_path = build_path_from_dentry(direntry);
	up(&direntry->d_sb->s_vfs_rename_sem);
	mutex_unlock(&direntry->d_sb->s_vfs_rename_mutex);


	if (!full_path)
	if (!full_path)
		goto out_no_free;
		goto out_no_free;
@@ -164,9 +164,9 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname)
	cifs_sb = CIFS_SB(inode->i_sb);
	cifs_sb = CIFS_SB(inode->i_sb);
	pTcon = cifs_sb->tcon;
	pTcon = cifs_sb->tcon;


	down(&inode->i_sb->s_vfs_rename_sem);
	mutex_lock(&inode->i_sb->s_vfs_rename_mutex);
	full_path = build_path_from_dentry(direntry);
	full_path = build_path_from_dentry(direntry);
	up(&inode->i_sb->s_vfs_rename_sem);
	mutex_unlock(&inode->i_sb->s_vfs_rename_mutex);


	if(full_path == NULL) {
	if(full_path == NULL) {
		FreeXid(xid);
		FreeXid(xid);
@@ -232,9 +232,9 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)


/* BB would it be safe against deadlock to grab this sem 
/* BB would it be safe against deadlock to grab this sem 
      even though rename itself grabs the sem and calls lookup? */
      even though rename itself grabs the sem and calls lookup? */
/*       down(&inode->i_sb->s_vfs_rename_sem);*/
/*       mutex_lock(&inode->i_sb->s_vfs_rename_mutex);*/
	full_path = build_path_from_dentry(direntry);
	full_path = build_path_from_dentry(direntry);
/*       up(&inode->i_sb->s_vfs_rename_sem);*/
/*       mutex_unlock(&inode->i_sb->s_vfs_rename_mutex);*/


	if(full_path == NULL) {
	if(full_path == NULL) {
		FreeXid(xid);
		FreeXid(xid);
Loading