1212#include <linux/ethtool.h>
1313#include <linux/falloc.h>
1414#include <linux/mount.h>
15- #define _NEED_FILE_LOCK_FIELD_MACROS
1615#include <linux/filelock.h>
1716
1817#include "glob.h"
@@ -6761,10 +6760,10 @@ struct file_lock *smb_flock_init(struct file *f)
67616760
67626761 locks_init_lock (fl );
67636762
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 ;
67686767 fl -> fl_ops = NULL ;
67696768 fl -> fl_lmops = NULL ;
67706769
@@ -6781,30 +6780,30 @@ static int smb2_set_flock_flags(struct file_lock *flock, int flags)
67816780 case SMB2_LOCKFLAG_SHARED :
67826781 ksmbd_debug (SMB , "received shared request\n" );
67836782 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 ;
67866785 break ;
67876786 case SMB2_LOCKFLAG_EXCLUSIVE :
67886787 ksmbd_debug (SMB , "received exclusive request\n" );
67896788 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 ;
67926791 break ;
67936792 case SMB2_LOCKFLAG_SHARED | SMB2_LOCKFLAG_FAIL_IMMEDIATELY :
67946793 ksmbd_debug (SMB ,
67956794 "received shared & fail immediately request\n" );
67966795 cmd = F_SETLK ;
6797- flock -> fl_type = F_RDLCK ;
6796+ flock -> c . flc_type = F_RDLCK ;
67986797 break ;
67996798 case SMB2_LOCKFLAG_EXCLUSIVE | SMB2_LOCKFLAG_FAIL_IMMEDIATELY :
68006799 ksmbd_debug (SMB ,
68016800 "received exclusive & fail immediately request\n" );
68026801 cmd = F_SETLK ;
6803- flock -> fl_type = F_WRLCK ;
6802+ flock -> c . flc_type = F_WRLCK ;
68046803 break ;
68056804 case SMB2_LOCKFLAG_UNLOCK :
68066805 ksmbd_debug (SMB , "received unlock request\n" );
6807- flock -> fl_type = F_UNLCK ;
6806+ flock -> c . flc_type = F_UNLCK ;
68086807 cmd = F_SETLK ;
68096808 break ;
68106809 }
@@ -6848,7 +6847,7 @@ static void smb2_remove_blocked_lock(void **argv)
68486847static inline bool lock_defer_pending (struct file_lock * fl )
68496848{
68506849 /* check pending lock waiters */
6851- return waitqueue_active (& fl -> fl_wait );
6850+ return waitqueue_active (& fl -> c . flc_wait );
68526851}
68536852
68546853/**
@@ -6939,8 +6938,8 @@ int smb2_lock(struct ksmbd_work *work)
69396938 list_for_each_entry (cmp_lock , & lock_list , llist ) {
69406939 if (cmp_lock -> fl -> fl_start <= flock -> fl_start &&
69416940 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 ) {
69446943 pr_err ("conflict two locks in one request\n" );
69456944 err = - EINVAL ;
69466945 locks_free_lock (flock );
@@ -6988,12 +6987,12 @@ int smb2_lock(struct ksmbd_work *work)
69886987 list_for_each_entry (conn , & conn_list , conns_list ) {
69896988 spin_lock (& conn -> llist_lock );
69906989 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 ))
69936992 continue ;
69946993
69956994 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 &&
69976996 cmp_lock -> start == smb_lock -> start &&
69986997 cmp_lock -> end == smb_lock -> end &&
69996998 !lock_defer_pending (cmp_lock -> fl )) {
@@ -7010,7 +7009,7 @@ int smb2_lock(struct ksmbd_work *work)
70107009 continue ;
70117010 }
70127011
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 ) {
70147013 if (smb_lock -> flags & SMB2_LOCKFLAG_SHARED )
70157014 continue ;
70167015 } else {
@@ -7176,7 +7175,7 @@ int smb2_lock(struct ksmbd_work *work)
71767175 struct file_lock * rlock = NULL ;
71777176
71787177 rlock = smb_flock_init (filp );
7179- rlock -> fl_type = F_UNLCK ;
7178+ rlock -> c . flc_type = F_UNLCK ;
71807179 rlock -> fl_start = smb_lock -> start ;
71817180 rlock -> fl_end = smb_lock -> end ;
71827181
0 commit comments