1212#include <linux/types.h>
1313#include <linux/errno.h>
1414#include <linux/fs.h>
15- #define _NEED_FILE_LOCK_FIELD_MACROS
1615#include <linux/filelock.h>
1716#include <linux/nfs_fs.h>
1817#include <linux/utsname.h>
@@ -134,7 +133,8 @@ static void nlmclnt_setlockargs(struct nlm_rqst *req, struct file_lock *fl)
134133 char * nodename = req -> a_host -> h_rpcclnt -> cl_nodename ;
135134
136135 nlmclnt_next_cookie (& argp -> cookie );
137- memcpy (& lock -> fh , NFS_FH (file_inode (fl -> fl_file )), sizeof (struct nfs_fh ));
136+ memcpy (& lock -> fh , NFS_FH (file_inode (fl -> c .flc_file )),
137+ sizeof (struct nfs_fh ));
138138 lock -> caller = nodename ;
139139 lock -> oh .data = req -> a_owner ;
140140 lock -> oh .len = snprintf (req -> a_owner , sizeof (req -> a_owner ), "%u@%s" ,
@@ -143,7 +143,7 @@ static void nlmclnt_setlockargs(struct nlm_rqst *req, struct file_lock *fl)
143143 lock -> svid = fl -> fl_u .nfs_fl .owner -> pid ;
144144 lock -> fl .fl_start = fl -> fl_start ;
145145 lock -> fl .fl_end = fl -> fl_end ;
146- lock -> fl .fl_type = fl -> fl_type ;
146+ lock -> fl .c . flc_type = fl -> c . flc_type ;
147147}
148148
149149static void nlmclnt_release_lockargs (struct nlm_rqst * req )
@@ -183,7 +183,7 @@ int nlmclnt_proc(struct nlm_host *host, int cmd, struct file_lock *fl, void *dat
183183 call -> a_callback_data = data ;
184184
185185 if (IS_SETLK (cmd ) || IS_SETLKW (cmd )) {
186- if (fl -> fl_type != F_UNLCK ) {
186+ if (fl -> c . flc_type != F_UNLCK ) {
187187 call -> a_args .block = IS_SETLKW (cmd ) ? 1 : 0 ;
188188 status = nlmclnt_lock (call , fl );
189189 } else
@@ -433,22 +433,23 @@ nlmclnt_test(struct nlm_rqst *req, struct file_lock *fl)
433433{
434434 int status ;
435435
436- status = nlmclnt_call (nfs_file_cred (fl -> fl_file ), req , NLMPROC_TEST );
436+ status = nlmclnt_call (nfs_file_cred (fl -> c .flc_file ), req ,
437+ NLMPROC_TEST );
437438 if (status < 0 )
438439 goto out ;
439440
440441 switch (req -> a_res .status ) {
441442 case nlm_granted :
442- fl -> fl_type = F_UNLCK ;
443+ fl -> c . flc_type = F_UNLCK ;
443444 break ;
444445 case nlm_lck_denied :
445446 /*
446447 * Report the conflicting lock back to the application.
447448 */
448449 fl -> fl_start = req -> a_res .lock .fl .fl_start ;
449450 fl -> fl_end = req -> a_res .lock .fl .fl_end ;
450- fl -> fl_type = req -> a_res .lock .fl .fl_type ;
451- fl -> fl_pid = - req -> a_res .lock .fl .fl_pid ;
451+ fl -> c . flc_type = req -> a_res .lock .fl .c . flc_type ;
452+ fl -> c . flc_pid = - req -> a_res .lock .fl .c . flc_pid ;
452453 break ;
453454 default :
454455 status = nlm_stat_to_errno (req -> a_res .status );
@@ -486,14 +487,15 @@ static const struct file_lock_operations nlmclnt_lock_ops = {
486487static void nlmclnt_locks_init_private (struct file_lock * fl , struct nlm_host * host )
487488{
488489 fl -> fl_u .nfs_fl .state = 0 ;
489- fl -> fl_u .nfs_fl .owner = nlmclnt_find_lockowner (host , fl -> fl_owner );
490+ fl -> fl_u .nfs_fl .owner = nlmclnt_find_lockowner (host ,
491+ fl -> c .flc_owner );
490492 INIT_LIST_HEAD (& fl -> fl_u .nfs_fl .list );
491493 fl -> fl_ops = & nlmclnt_lock_ops ;
492494}
493495
494496static int do_vfs_lock (struct file_lock * fl )
495497{
496- return locks_lock_file_wait (fl -> fl_file , fl );
498+ return locks_lock_file_wait (fl -> c . flc_file , fl );
497499}
498500
499501/*
@@ -519,11 +521,11 @@ static int do_vfs_lock(struct file_lock *fl)
519521static int
520522nlmclnt_lock (struct nlm_rqst * req , struct file_lock * fl )
521523{
522- const struct cred * cred = nfs_file_cred (fl -> fl_file );
524+ const struct cred * cred = nfs_file_cred (fl -> c . flc_file );
523525 struct nlm_host * host = req -> a_host ;
524526 struct nlm_res * resp = & req -> a_res ;
525527 struct nlm_wait block ;
526- unsigned char flags = fl -> fl_flags ;
528+ unsigned char flags = fl -> c . flc_flags ;
527529 unsigned char type ;
528530 __be32 b_status ;
529531 int status = - ENOLCK ;
@@ -532,9 +534,9 @@ nlmclnt_lock(struct nlm_rqst *req, struct file_lock *fl)
532534 goto out ;
533535 req -> a_args .state = nsm_local_state ;
534536
535- fl -> fl_flags |= FL_ACCESS ;
537+ fl -> c . flc_flags |= FL_ACCESS ;
536538 status = do_vfs_lock (fl );
537- fl -> fl_flags = flags ;
539+ fl -> c . flc_flags = flags ;
538540 if (status < 0 )
539541 goto out ;
540542
@@ -592,11 +594,11 @@ nlmclnt_lock(struct nlm_rqst *req, struct file_lock *fl)
592594 goto again ;
593595 }
594596 /* Ensure the resulting lock will get added to granted list */
595- fl -> fl_flags |= FL_SLEEP ;
597+ fl -> c . flc_flags |= FL_SLEEP ;
596598 if (do_vfs_lock (fl ) < 0 )
597599 printk (KERN_WARNING "%s: VFS is out of sync with lock manager!\n" , __func__ );
598600 up_read (& host -> h_rwsem );
599- fl -> fl_flags = flags ;
601+ fl -> c . flc_flags = flags ;
600602 status = 0 ;
601603 }
602604 if (status < 0 )
@@ -623,13 +625,13 @@ nlmclnt_lock(struct nlm_rqst *req, struct file_lock *fl)
623625 req -> a_host -> h_addrlen , req -> a_res .status );
624626 dprintk ("lockd: lock attempt ended in fatal error.\n"
625627 " Attempting to unlock.\n" );
626- type = fl -> fl_type ;
627- fl -> fl_type = F_UNLCK ;
628+ type = fl -> c . flc_type ;
629+ fl -> c . flc_type = F_UNLCK ;
628630 down_read (& host -> h_rwsem );
629631 do_vfs_lock (fl );
630632 up_read (& host -> h_rwsem );
631- fl -> fl_type = type ;
632- fl -> fl_flags = flags ;
633+ fl -> c . flc_type = type ;
634+ fl -> c . flc_flags = flags ;
633635 nlmclnt_async_call (cred , req , NLMPROC_UNLOCK , & nlmclnt_unlock_ops );
634636 return status ;
635637}
@@ -652,12 +654,14 @@ nlmclnt_reclaim(struct nlm_host *host, struct file_lock *fl,
652654 nlmclnt_setlockargs (req , fl );
653655 req -> a_args .reclaim = 1 ;
654656
655- status = nlmclnt_call (nfs_file_cred (fl -> fl_file ), req , NLMPROC_LOCK );
657+ status = nlmclnt_call (nfs_file_cred (fl -> c .flc_file ), req ,
658+ NLMPROC_LOCK );
656659 if (status >= 0 && req -> a_res .status == nlm_granted )
657660 return 0 ;
658661
659662 printk (KERN_WARNING "lockd: failed to reclaim lock for pid %d "
660- "(errno %d, status %d)\n" , fl -> fl_pid ,
663+ "(errno %d, status %d)\n" ,
664+ fl -> c .flc_pid ,
661665 status , ntohl (req -> a_res .status ));
662666
663667 /*
@@ -684,26 +688,26 @@ nlmclnt_unlock(struct nlm_rqst *req, struct file_lock *fl)
684688 struct nlm_host * host = req -> a_host ;
685689 struct nlm_res * resp = & req -> a_res ;
686690 int status ;
687- unsigned char flags = fl -> fl_flags ;
691+ unsigned char flags = fl -> c . flc_flags ;
688692
689693 /*
690694 * Note: the server is supposed to either grant us the unlock
691695 * request, or to deny it with NLM_LCK_DENIED_GRACE_PERIOD. In either
692696 * case, we want to unlock.
693697 */
694- fl -> fl_flags |= FL_EXISTS ;
698+ fl -> c . flc_flags |= FL_EXISTS ;
695699 down_read (& host -> h_rwsem );
696700 status = do_vfs_lock (fl );
697701 up_read (& host -> h_rwsem );
698- fl -> fl_flags = flags ;
702+ fl -> c . flc_flags = flags ;
699703 if (status == - ENOENT ) {
700704 status = 0 ;
701705 goto out ;
702706 }
703707
704708 refcount_inc (& req -> a_count );
705- status = nlmclnt_async_call (nfs_file_cred (fl -> fl_file ), req ,
706- NLMPROC_UNLOCK , & nlmclnt_unlock_ops );
709+ status = nlmclnt_async_call (nfs_file_cred (fl -> c . flc_file ), req ,
710+ NLMPROC_UNLOCK , & nlmclnt_unlock_ops );
707711 if (status < 0 )
708712 goto out ;
709713
@@ -796,8 +800,8 @@ static int nlmclnt_cancel(struct nlm_host *host, int block, struct file_lock *fl
796800 req -> a_args .block = block ;
797801
798802 refcount_inc (& req -> a_count );
799- status = nlmclnt_async_call (nfs_file_cred (fl -> fl_file ), req ,
800- NLMPROC_CANCEL , & nlmclnt_cancel_ops );
803+ status = nlmclnt_async_call (nfs_file_cred (fl -> c . flc_file ), req ,
804+ NLMPROC_CANCEL , & nlmclnt_cancel_ops );
801805 if (status == 0 && req -> a_res .status == nlm_lck_denied )
802806 status = - ENOLCK ;
803807 nlmclnt_release_call (req );
0 commit comments