OpenVZ Forum


Home » Mailing lists » Devel » [patch 16/22] unix_find_other() elevate write count for touch_atime()
[patch 16/22] unix_find_other() elevate write count for touch_atime() [message #18816] Thu, 07 June 2007 15:25
Cedric Le Goater is currently offline  Cedric Le Goater
Messages: 443
Registered: February 2006
Senior Member
From: Dave Hansen <hansendc@us.ibm.com>

Signed-off-by: Dave Hansen <hansendc@us.ibm.com>
---

---
 net/unix/af_unix.c |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

Index: 2.6.22-rc4-mm2-robindmount/net/unix/af_unix.c
===================================================================
--- 2.6.22-rc4-mm2-robindmount.orig/net/unix/af_unix.c
+++ 2.6.22-rc4-mm2-robindmount/net/unix/af_unix.c
@@ -702,21 +702,27 @@ static struct sock *unix_find_other(stru
 		err = path_lookup(sunname->sun_path, LOOKUP_FOLLOW, &nd);
 		if (err)
 			goto fail;
+
+		err = mnt_want_write(nd.mnt);
+		if (err)
+			goto put_path_fail;
+
 		err = vfs_permission(&nd, MAY_WRITE);
 		if (err)
-			goto put_fail;
+			goto mnt_drop_write_fail;
 
 		err = -ECONNREFUSED;
 		if (!S_ISSOCK(nd.dentry->d_inode->i_mode))
-			goto put_fail;
+			goto mnt_drop_write_fail;
 		u=unix_find_socket_byinode(nd.dentry->d_inode);
 		if (!u)
-			goto put_fail;
+			goto mnt_drop_write_fail;
 
 		if (u->sk_type == type)
 			touch_atime(nd.mnt, nd.dentry);
 
 		path_release(&nd);
+		mnt_drop_write(nd.mnt);
 
 		err=-EPROTOTYPE;
 		if (u->sk_type != type) {
@@ -736,7 +742,9 @@ static struct sock *unix_find_other(stru
 	}
 	return u;
 
-put_fail:
+mnt_drop_write_fail:
+	mnt_drop_write(nd.mnt);
+put_path_fail:
 	path_release(&nd);
 fail:
 	*error=err;

-- 
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Previous Topic: [patch 15/22] elevate write count for file_update_time()
Next Topic: [patch 17/22] elevate write count over calls to vfs_rename()
Goto Forum:
  


Current Time: Wed Aug 27 10:24:41 GMT 2025

Total time taken to generate the page: 0.27299 seconds