File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -355,14 +355,24 @@ static __poll_t cachefiles_daemon_poll(struct file *file,
355355 struct poll_table_struct * poll )
356356{
357357 struct cachefiles_cache * cache = file -> private_data ;
358+ XA_STATE (xas , & cache -> reqs , 0 );
359+ struct cachefiles_req * req ;
358360 __poll_t mask ;
359361
360362 poll_wait (file , & cache -> daemon_pollwq , poll );
361363 mask = 0 ;
362364
363365 if (cachefiles_in_ondemand_mode (cache )) {
364- if (!xa_empty (& cache -> reqs ))
365- mask |= EPOLLIN ;
366+ if (!xa_empty (& cache -> reqs )) {
367+ rcu_read_lock ();
368+ xas_for_each_marked (& xas , req , ULONG_MAX , CACHEFILES_REQ_NEW ) {
369+ if (!cachefiles_ondemand_is_reopening_read (req )) {
370+ mask |= EPOLLIN ;
371+ break ;
372+ }
373+ }
374+ rcu_read_unlock ();
375+ }
366376 } else {
367377 if (test_bit (CACHEFILES_STATE_CHANGED , & cache -> flags ))
368378 mask |= EPOLLIN ;
Original file line number Diff line number Diff line change @@ -329,6 +329,13 @@ cachefiles_ondemand_set_object_##_state(struct cachefiles_object *object) \
329329CACHEFILES_OBJECT_STATE_FUNCS (open , OPEN );
330330CACHEFILES_OBJECT_STATE_FUNCS (close , CLOSE );
331331CACHEFILES_OBJECT_STATE_FUNCS (reopening , REOPENING );
332+
333+ static inline bool cachefiles_ondemand_is_reopening_read (struct cachefiles_req * req )
334+ {
335+ return cachefiles_ondemand_object_is_reopening (req -> object ) &&
336+ req -> msg .opcode == CACHEFILES_OP_READ ;
337+ }
338+
332339#else
333340static inline ssize_t cachefiles_ondemand_daemon_read (struct cachefiles_cache * cache ,
334341 char __user * _buffer , size_t buflen )
@@ -359,6 +366,11 @@ static inline int cachefiles_ondemand_init_obj_info(struct cachefiles_object *ob
359366static inline void cachefiles_ondemand_deinit_obj_info (struct cachefiles_object * obj )
360367{
361368}
369+
370+ static inline bool cachefiles_ondemand_is_reopening_read (struct cachefiles_req * req )
371+ {
372+ return false;
373+ }
362374#endif
363375
364376/*
You can’t perform that action at this time.
0 commit comments