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

Jeff Layton jlayton at poochiereds.net
Sat Mar 28 14:34:07 GMT 2009


On Sat, 28 Mar 2009 14:27:11 +0300
Pavel Shilovsky <piastry at etersoft.ru> wrote:

> Previous patch only added right behaviour without option forcemand. Here 
> is another path that works right with forcemand and without it.
> 
> 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:
> diff --git a/fs/cifs/file.c b/fs/cifs/file.c
> index 6851043..7e333c2 100644
> --- a/fs/cifs/file.c
> +++ b/fs/cifs/file.c
> @@ -898,6 +898,25 @@ int cifs_lock(struct file *file, int cmd, struct 
> file_lock *pfLock)
>              /* if rc == ERR_SHARING_VIOLATION ? */
>              rc = 0;    /* do not change lock type to unlock
>                     since range in use */
> +            if (lockType | LOCKING_ANDX_SHARED_LOCK) {
> +                pfLock->fl_type = F_WRLCK;
> +            } else {
> +                rc = CIFSSMBLock(xid, pTcon, netfid, length, 
> pfLock->fl_start,

^^^ these patches aren't useful to anyone willing to try them out. Your
mailer (looks like Thunderbird?) is word-wrapping them.

I suggest emailing these to yourself first and then seeing if you can
save off the result get them to apply cleanly. Once you get that
working right, then go ahead and send them to the list.

Alternately, you could just use git-format-patch and git-send-email to
send patches.

> +                     0, 1, lockType | LOCKING_ANDX_SHARED_LOCK, 0 /* 
> wait flag */ );
> +                if (rc == 0) {
> +                    rc = CIFSSMBLock(xid, pTcon, netfid, length,
> +                         pfLock->fl_start, 1 /* numUnlock */ ,
> +                         0 /* numLock */ , lockType | 
> LOCKING_ANDX_SHARED_LOCK,
> +                         0 /* wait flag */ );
> +                    pfLock->fl_type = F_RDLCK;
> +                    if (rc != 0)
> +                        cERROR(1, ("Error unlocking previously locked "
> +                           "range %d during test of lock", rc));
> +                    rc = 0;
> +                } else {
> +                    pfLock->fl_type = F_WRLCK;
> +                }
> +            }
>          }
>  
>          FreeXid(xid);
> 
>  Signed-off-by: Pavel Shilovsky <piastryyy at gmail.com>
> 
> --
> Best regards,
> Pavel Shilovsky.
> _______________________________________________
> linux-cifs-client mailing list
> linux-cifs-client at lists.samba.org
> https://lists.samba.org/mailman/listinfo/linux-cifs-client
> 


-- 
Jeff Layton <jlayton at poochiereds.net>


More information about the linux-cifs-client mailing list