[linux-cifs-client] [PATCH] F_GETLK request - returning value

Pavel Shilovsky piastry at etersoft.ru
Thu Mar 26 12:41:18 GMT 2009


Hello!

I had problem with F_GETLK request in fcntl() function: it didn't return 
info about exist lock, if it prevents our lock.

Here is my patch.

diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 8f0f86d..aa26a3a 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -1882,6 +1882,16 @@ CIFSSMBPosixLock(const int xid, struct 
cifsTconInfo *tcon,
                        ((char *)&pSMBr->hdr.Protocol + data_offset);
                if (parm_data->lock_type == cpu_to_le16(CIFS_UNLCK))
                        pLockData->fl_type = F_UNLCK;
+               else {
+                       if (parm_data->lock_type == cpu_to_le16(CIFS_RDLCK))
+                               pLockData->fl_type = F_RDLCK;
+                       else if (parm_data->lock_type == 
cpu_to_le16(CIFS_WRLCK))
+                               pLockData->fl_type = F_WRLCK;
+
+                       pLockData->fl_start = parm_data->start;
+                       pLockData->fl_end = parm_data->start + 
parm_data->length - 1;
+                       pLockData->fl_pid = parm_data->pid;
+               }
        }

 plk_err_exit:


--
Best regards,
Pavel Shilovsky.


More information about the linux-cifs-client mailing list