12
12
#include <linux/types.h>
13
13
#include <linux/errno.h>
14
14
#include <linux/fs.h>
15
- #define _NEED_FILE_LOCK_FIELD_MACROS
16
15
#include <linux/filelock.h>
17
16
#include <linux/nfs_fs.h>
18
17
#include <linux/utsname.h>
@@ -134,7 +133,8 @@ static void nlmclnt_setlockargs(struct nlm_rqst *req, struct file_lock *fl)
134
133
char * nodename = req -> a_host -> h_rpcclnt -> cl_nodename ;
135
134
136
135
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 ));
138
138
lock -> caller = nodename ;
139
139
lock -> oh .data = req -> a_owner ;
140
140
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)
143
143
lock -> svid = fl -> fl_u .nfs_fl .owner -> pid ;
144
144
lock -> fl .fl_start = fl -> fl_start ;
145
145
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 ;
147
147
}
148
148
149
149
static 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
183
183
call -> a_callback_data = data ;
184
184
185
185
if (IS_SETLK (cmd ) || IS_SETLKW (cmd )) {
186
- if (fl -> fl_type != F_UNLCK ) {
186
+ if (fl -> c . flc_type != F_UNLCK ) {
187
187
call -> a_args .block = IS_SETLKW (cmd ) ? 1 : 0 ;
188
188
status = nlmclnt_lock (call , fl );
189
189
} else
@@ -433,22 +433,23 @@ nlmclnt_test(struct nlm_rqst *req, struct file_lock *fl)
433
433
{
434
434
int status ;
435
435
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 );
437
438
if (status < 0 )
438
439
goto out ;
439
440
440
441
switch (req -> a_res .status ) {
441
442
case nlm_granted :
442
- fl -> fl_type = F_UNLCK ;
443
+ fl -> c . flc_type = F_UNLCK ;
443
444
break ;
444
445
case nlm_lck_denied :
445
446
/*
446
447
* Report the conflicting lock back to the application.
447
448
*/
448
449
fl -> fl_start = req -> a_res .lock .fl .fl_start ;
449
450
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 ;
452
453
break ;
453
454
default :
454
455
status = nlm_stat_to_errno (req -> a_res .status );
@@ -486,14 +487,15 @@ static const struct file_lock_operations nlmclnt_lock_ops = {
486
487
static void nlmclnt_locks_init_private (struct file_lock * fl , struct nlm_host * host )
487
488
{
488
489
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 );
490
492
INIT_LIST_HEAD (& fl -> fl_u .nfs_fl .list );
491
493
fl -> fl_ops = & nlmclnt_lock_ops ;
492
494
}
493
495
494
496
static int do_vfs_lock (struct file_lock * fl )
495
497
{
496
- return locks_lock_file_wait (fl -> fl_file , fl );
498
+ return locks_lock_file_wait (fl -> c . flc_file , fl );
497
499
}
498
500
499
501
/*
@@ -519,11 +521,11 @@ static int do_vfs_lock(struct file_lock *fl)
519
521
static int
520
522
nlmclnt_lock (struct nlm_rqst * req , struct file_lock * fl )
521
523
{
522
- const struct cred * cred = nfs_file_cred (fl -> fl_file );
524
+ const struct cred * cred = nfs_file_cred (fl -> c . flc_file );
523
525
struct nlm_host * host = req -> a_host ;
524
526
struct nlm_res * resp = & req -> a_res ;
525
527
struct nlm_wait block ;
526
- unsigned char flags = fl -> fl_flags ;
528
+ unsigned char flags = fl -> c . flc_flags ;
527
529
unsigned char type ;
528
530
__be32 b_status ;
529
531
int status = - ENOLCK ;
@@ -532,9 +534,9 @@ nlmclnt_lock(struct nlm_rqst *req, struct file_lock *fl)
532
534
goto out ;
533
535
req -> a_args .state = nsm_local_state ;
534
536
535
- fl -> fl_flags |= FL_ACCESS ;
537
+ fl -> c . flc_flags |= FL_ACCESS ;
536
538
status = do_vfs_lock (fl );
537
- fl -> fl_flags = flags ;
539
+ fl -> c . flc_flags = flags ;
538
540
if (status < 0 )
539
541
goto out ;
540
542
@@ -592,11 +594,11 @@ nlmclnt_lock(struct nlm_rqst *req, struct file_lock *fl)
592
594
goto again ;
593
595
}
594
596
/* Ensure the resulting lock will get added to granted list */
595
- fl -> fl_flags |= FL_SLEEP ;
597
+ fl -> c . flc_flags |= FL_SLEEP ;
596
598
if (do_vfs_lock (fl ) < 0 )
597
599
printk (KERN_WARNING "%s: VFS is out of sync with lock manager!\n" , __func__ );
598
600
up_read (& host -> h_rwsem );
599
- fl -> fl_flags = flags ;
601
+ fl -> c . flc_flags = flags ;
600
602
status = 0 ;
601
603
}
602
604
if (status < 0 )
@@ -623,13 +625,13 @@ nlmclnt_lock(struct nlm_rqst *req, struct file_lock *fl)
623
625
req -> a_host -> h_addrlen , req -> a_res .status );
624
626
dprintk ("lockd: lock attempt ended in fatal error.\n"
625
627
" 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 ;
628
630
down_read (& host -> h_rwsem );
629
631
do_vfs_lock (fl );
630
632
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 ;
633
635
nlmclnt_async_call (cred , req , NLMPROC_UNLOCK , & nlmclnt_unlock_ops );
634
636
return status ;
635
637
}
@@ -652,12 +654,14 @@ nlmclnt_reclaim(struct nlm_host *host, struct file_lock *fl,
652
654
nlmclnt_setlockargs (req , fl );
653
655
req -> a_args .reclaim = 1 ;
654
656
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 );
656
659
if (status >= 0 && req -> a_res .status == nlm_granted )
657
660
return 0 ;
658
661
659
662
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 ,
661
665
status , ntohl (req -> a_res .status ));
662
666
663
667
/*
@@ -684,26 +688,26 @@ nlmclnt_unlock(struct nlm_rqst *req, struct file_lock *fl)
684
688
struct nlm_host * host = req -> a_host ;
685
689
struct nlm_res * resp = & req -> a_res ;
686
690
int status ;
687
- unsigned char flags = fl -> fl_flags ;
691
+ unsigned char flags = fl -> c . flc_flags ;
688
692
689
693
/*
690
694
* Note: the server is supposed to either grant us the unlock
691
695
* request, or to deny it with NLM_LCK_DENIED_GRACE_PERIOD. In either
692
696
* case, we want to unlock.
693
697
*/
694
- fl -> fl_flags |= FL_EXISTS ;
698
+ fl -> c . flc_flags |= FL_EXISTS ;
695
699
down_read (& host -> h_rwsem );
696
700
status = do_vfs_lock (fl );
697
701
up_read (& host -> h_rwsem );
698
- fl -> fl_flags = flags ;
702
+ fl -> c . flc_flags = flags ;
699
703
if (status == - ENOENT ) {
700
704
status = 0 ;
701
705
goto out ;
702
706
}
703
707
704
708
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 );
707
711
if (status < 0 )
708
712
goto out ;
709
713
@@ -796,8 +800,8 @@ static int nlmclnt_cancel(struct nlm_host *host, int block, struct file_lock *fl
796
800
req -> a_args .block = block ;
797
801
798
802
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 );
801
805
if (status == 0 && req -> a_res .status == nlm_lck_denied )
802
806
status = - ENOLCK ;
803
807
nlmclnt_release_call (req );
0 commit comments