[PATCH v3 2/6 incubator] Apply appropriate locking for missing pread/pwrite api

Damien Zammit <[email protected]>
Newsgroups gmane.os.hurd.bugs
Message-ID <[email protected]>
---
 smbnetfs.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/smbnetfs.c b/smbnetfs.c
index cae5f7350..950d1560b 100644
--- a/smbnetfs.c
+++ b/smbnetfs.c
@@ -712,18 +712,15 @@ netfs_attempt_read (struct iouser * cred, struct node * np, loff_t offset,
 
   pthread_mutex_lock (&smb_mutex);
   ret = smbc_getFunctionLseek(ctx) (ctx, fd, offset2, SEEK_SET);
-  pthread_mutex_unlock (&smb_mutex);
   
   if ((ret < 0) || (ret != offset2))
     {
       *len = 0;
-      pthread_mutex_lock (&smb_mutex);
       smbc_getFunctionClose(ctx) (ctx, fd);
       pthread_mutex_unlock (&smb_mutex);
       return errno;
     }
 
-  pthread_mutex_lock (&smb_mutex);
   ret = smbc_getFunctionRead(ctx) (ctx, fd, data, *len);
   pthread_mutex_unlock (&smb_mutex);
 
@@ -773,17 +770,14 @@ netfs_attempt_write (struct iouser * cred, struct node * np, loff_t offset,
     }
   pthread_mutex_lock (&smb_mutex);
   ret = smbc_getFunctionLseek(ctx) (ctx, fd, offset2, SEEK_SET);
-  pthread_mutex_unlock (&smb_mutex);
   
   if ((ret < 0) || (ret != offset2))
     {
       *len = 0;
-      pthread_mutex_lock (&smb_mutex);
       smbc_getFunctionClose(ctx) (ctx, fd);
       pthread_mutex_unlock (&smb_mutex);
       return errno;
     }
-  pthread_mutex_lock (&smb_mutex);
   ret = smbc_getFunctionWrite(ctx) (ctx, fd, data, *len);
   pthread_mutex_unlock (&smb_mutex);
   
-- 
2.51.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.