12
12
#include <linux/ethtool.h>
13
13
#include <linux/falloc.h>
14
14
#include <linux/mount.h>
15
- #define _NEED_FILE_LOCK_FIELD_MACROS
16
15
#include <linux/filelock.h>
17
16
18
17
#include "glob.h"
@@ -6761,10 +6760,10 @@ struct file_lock *smb_flock_init(struct file *f)
6761
6760
6762
6761
locks_init_lock (fl );
6763
6762
6764
- fl -> fl_owner = f ;
6765
- fl -> fl_pid = current -> tgid ;
6766
- fl -> fl_file = f ;
6767
- fl -> fl_flags = FL_POSIX ;
6763
+ fl -> c . flc_owner = f ;
6764
+ fl -> c . flc_pid = current -> tgid ;
6765
+ fl -> c . flc_file = f ;
6766
+ fl -> c . flc_flags = FL_POSIX ;
6768
6767
fl -> fl_ops = NULL ;
6769
6768
fl -> fl_lmops = NULL ;
6770
6769
@@ -6781,30 +6780,30 @@ static int smb2_set_flock_flags(struct file_lock *flock, int flags)
6781
6780
case SMB2_LOCKFLAG_SHARED :
6782
6781
ksmbd_debug (SMB , "received shared request\n" );
6783
6782
cmd = F_SETLKW ;
6784
- flock -> fl_type = F_RDLCK ;
6785
- flock -> fl_flags |= FL_SLEEP ;
6783
+ flock -> c . flc_type = F_RDLCK ;
6784
+ flock -> c . flc_flags |= FL_SLEEP ;
6786
6785
break ;
6787
6786
case SMB2_LOCKFLAG_EXCLUSIVE :
6788
6787
ksmbd_debug (SMB , "received exclusive request\n" );
6789
6788
cmd = F_SETLKW ;
6790
- flock -> fl_type = F_WRLCK ;
6791
- flock -> fl_flags |= FL_SLEEP ;
6789
+ flock -> c . flc_type = F_WRLCK ;
6790
+ flock -> c . flc_flags |= FL_SLEEP ;
6792
6791
break ;
6793
6792
case SMB2_LOCKFLAG_SHARED | SMB2_LOCKFLAG_FAIL_IMMEDIATELY :
6794
6793
ksmbd_debug (SMB ,
6795
6794
"received shared & fail immediately request\n" );
6796
6795
cmd = F_SETLK ;
6797
- flock -> fl_type = F_RDLCK ;
6796
+ flock -> c . flc_type = F_RDLCK ;
6798
6797
break ;
6799
6798
case SMB2_LOCKFLAG_EXCLUSIVE | SMB2_LOCKFLAG_FAIL_IMMEDIATELY :
6800
6799
ksmbd_debug (SMB ,
6801
6800
"received exclusive & fail immediately request\n" );
6802
6801
cmd = F_SETLK ;
6803
- flock -> fl_type = F_WRLCK ;
6802
+ flock -> c . flc_type = F_WRLCK ;
6804
6803
break ;
6805
6804
case SMB2_LOCKFLAG_UNLOCK :
6806
6805
ksmbd_debug (SMB , "received unlock request\n" );
6807
- flock -> fl_type = F_UNLCK ;
6806
+ flock -> c . flc_type = F_UNLCK ;
6808
6807
cmd = F_SETLK ;
6809
6808
break ;
6810
6809
}
@@ -6848,7 +6847,7 @@ static void smb2_remove_blocked_lock(void **argv)
6848
6847
static inline bool lock_defer_pending (struct file_lock * fl )
6849
6848
{
6850
6849
/* check pending lock waiters */
6851
- return waitqueue_active (& fl -> fl_wait );
6850
+ return waitqueue_active (& fl -> c . flc_wait );
6852
6851
}
6853
6852
6854
6853
/**
@@ -6939,8 +6938,8 @@ int smb2_lock(struct ksmbd_work *work)
6939
6938
list_for_each_entry (cmp_lock , & lock_list , llist ) {
6940
6939
if (cmp_lock -> fl -> fl_start <= flock -> fl_start &&
6941
6940
cmp_lock -> fl -> fl_end >= flock -> fl_end ) {
6942
- if (cmp_lock -> fl -> fl_type != F_UNLCK &&
6943
- flock -> fl_type != F_UNLCK ) {
6941
+ if (cmp_lock -> fl -> c . flc_type != F_UNLCK &&
6942
+ flock -> c . flc_type != F_UNLCK ) {
6944
6943
pr_err ("conflict two locks in one request\n" );
6945
6944
err = - EINVAL ;
6946
6945
locks_free_lock (flock );
@@ -6988,12 +6987,12 @@ int smb2_lock(struct ksmbd_work *work)
6988
6987
list_for_each_entry (conn , & conn_list , conns_list ) {
6989
6988
spin_lock (& conn -> llist_lock );
6990
6989
list_for_each_entry_safe (cmp_lock , tmp2 , & conn -> lock_list , clist ) {
6991
- if (file_inode (cmp_lock -> fl -> fl_file ) !=
6992
- file_inode (smb_lock -> fl -> fl_file ))
6990
+ if (file_inode (cmp_lock -> fl -> c . flc_file ) !=
6991
+ file_inode (smb_lock -> fl -> c . flc_file ))
6993
6992
continue ;
6994
6993
6995
6994
if (lock_is_unlock (smb_lock -> fl )) {
6996
- if (cmp_lock -> fl -> fl_file == smb_lock -> fl -> fl_file &&
6995
+ if (cmp_lock -> fl -> c . flc_file == smb_lock -> fl -> c . flc_file &&
6997
6996
cmp_lock -> start == smb_lock -> start &&
6998
6997
cmp_lock -> end == smb_lock -> end &&
6999
6998
!lock_defer_pending (cmp_lock -> fl )) {
@@ -7010,7 +7009,7 @@ int smb2_lock(struct ksmbd_work *work)
7010
7009
continue ;
7011
7010
}
7012
7011
7013
- if (cmp_lock -> fl -> fl_file == smb_lock -> fl -> fl_file ) {
7012
+ if (cmp_lock -> fl -> c . flc_file == smb_lock -> fl -> c . flc_file ) {
7014
7013
if (smb_lock -> flags & SMB2_LOCKFLAG_SHARED )
7015
7014
continue ;
7016
7015
} else {
@@ -7176,7 +7175,7 @@ int smb2_lock(struct ksmbd_work *work)
7176
7175
struct file_lock * rlock = NULL ;
7177
7176
7178
7177
rlock = smb_flock_init (filp );
7179
- rlock -> fl_type = F_UNLCK ;
7178
+ rlock -> c . flc_type = F_UNLCK ;
7180
7179
rlock -> fl_start = smb_lock -> start ;
7181
7180
rlock -> fl_end = smb_lock -> end ;
7182
7181
0 commit comments