@@ -851,9 +851,9 @@ static bool emit_cached_dirents(struct cached_dirents *cde,
851
851
}
852
852
853
853
static void update_cached_dirents_count (struct cached_dirents * cde ,
854
- struct dir_context * ctx )
854
+ struct file * file )
855
855
{
856
- if (cde -> ctx != ctx )
856
+ if (cde -> file != file )
857
857
return ;
858
858
if (cde -> is_valid || cde -> is_failed )
859
859
return ;
@@ -862,9 +862,9 @@ static void update_cached_dirents_count(struct cached_dirents *cde,
862
862
}
863
863
864
864
static void finished_cached_dirents_count (struct cached_dirents * cde ,
865
- struct dir_context * ctx )
865
+ struct dir_context * ctx , struct file * file )
866
866
{
867
- if (cde -> ctx != ctx )
867
+ if (cde -> file != file )
868
868
return ;
869
869
if (cde -> is_valid || cde -> is_failed )
870
870
return ;
@@ -877,11 +877,12 @@ static void finished_cached_dirents_count(struct cached_dirents *cde,
877
877
static void add_cached_dirent (struct cached_dirents * cde ,
878
878
struct dir_context * ctx ,
879
879
const char * name , int namelen ,
880
- struct cifs_fattr * fattr )
880
+ struct cifs_fattr * fattr ,
881
+ struct file * file )
881
882
{
882
883
struct cached_dirent * de ;
883
884
884
- if (cde -> ctx != ctx )
885
+ if (cde -> file != file )
885
886
return ;
886
887
if (cde -> is_valid || cde -> is_failed )
887
888
return ;
@@ -911,7 +912,8 @@ static void add_cached_dirent(struct cached_dirents *cde,
911
912
static bool cifs_dir_emit (struct dir_context * ctx ,
912
913
const char * name , int namelen ,
913
914
struct cifs_fattr * fattr ,
914
- struct cached_fid * cfid )
915
+ struct cached_fid * cfid ,
916
+ struct file * file )
915
917
{
916
918
bool rc ;
917
919
ino_t ino = cifs_uniqueid_to_ino_t (fattr -> cf_uniqueid );
@@ -923,7 +925,7 @@ static bool cifs_dir_emit(struct dir_context *ctx,
923
925
if (cfid ) {
924
926
mutex_lock (& cfid -> dirents .de_mutex );
925
927
add_cached_dirent (& cfid -> dirents , ctx , name , namelen ,
926
- fattr );
928
+ fattr , file );
927
929
mutex_unlock (& cfid -> dirents .de_mutex );
928
930
}
929
931
@@ -1023,7 +1025,7 @@ static int cifs_filldir(char *find_entry, struct file *file,
1023
1025
cifs_prime_dcache (file_dentry (file ), & name , & fattr );
1024
1026
1025
1027
return !cifs_dir_emit (ctx , name .name , name .len ,
1026
- & fattr , cfid );
1028
+ & fattr , cfid , file );
1027
1029
}
1028
1030
1029
1031
@@ -1074,8 +1076,8 @@ int cifs_readdir(struct file *file, struct dir_context *ctx)
1074
1076
* we need to initialize scanning and storing the
1075
1077
* directory content.
1076
1078
*/
1077
- if (ctx -> pos == 0 && cfid -> dirents .ctx == NULL ) {
1078
- cfid -> dirents .ctx = ctx ;
1079
+ if (ctx -> pos == 0 && cfid -> dirents .file == NULL ) {
1080
+ cfid -> dirents .file = file ;
1079
1081
cfid -> dirents .pos = 2 ;
1080
1082
}
1081
1083
/*
@@ -1143,7 +1145,7 @@ int cifs_readdir(struct file *file, struct dir_context *ctx)
1143
1145
} else {
1144
1146
if (cfid ) {
1145
1147
mutex_lock (& cfid -> dirents .de_mutex );
1146
- finished_cached_dirents_count (& cfid -> dirents , ctx );
1148
+ finished_cached_dirents_count (& cfid -> dirents , ctx , file );
1147
1149
mutex_unlock (& cfid -> dirents .de_mutex );
1148
1150
}
1149
1151
cifs_dbg (FYI , "Could not find entry\n" );
@@ -1184,7 +1186,7 @@ int cifs_readdir(struct file *file, struct dir_context *ctx)
1184
1186
ctx -> pos ++ ;
1185
1187
if (cfid ) {
1186
1188
mutex_lock (& cfid -> dirents .de_mutex );
1187
- update_cached_dirents_count (& cfid -> dirents , ctx );
1189
+ update_cached_dirents_count (& cfid -> dirents , file );
1188
1190
mutex_unlock (& cfid -> dirents .de_mutex );
1189
1191
}
1190
1192
0 commit comments