@@ -101,7 +101,7 @@ static void fuse_drop_waiting(struct fuse_conn *fc)
101101 }
102102}
103103
104- static void fuse_put_request (struct fuse_conn * fc , struct fuse_req * req );
104+ static void fuse_put_request (struct fuse_req * req );
105105
106106static struct fuse_req * fuse_get_req (struct fuse_conn * fc , bool for_background )
107107{
@@ -144,7 +144,7 @@ static struct fuse_req *fuse_get_req(struct fuse_conn *fc, bool for_background)
144144
145145 if (unlikely (req -> in .h .uid == ((uid_t )- 1 ) ||
146146 req -> in .h .gid == ((gid_t )- 1 ))) {
147- fuse_put_request (fc , req );
147+ fuse_put_request (req );
148148 return ERR_PTR (- EOVERFLOW );
149149 }
150150 return req ;
@@ -154,8 +154,10 @@ static struct fuse_req *fuse_get_req(struct fuse_conn *fc, bool for_background)
154154 return ERR_PTR (err );
155155}
156156
157- static void fuse_put_request (struct fuse_conn * fc , struct fuse_req * req )
157+ static void fuse_put_request (struct fuse_req * req )
158158{
159+ struct fuse_conn * fc = req -> fc ;
160+
159161 if (refcount_dec_and_test (& req -> count )) {
160162 if (test_bit (FR_BACKGROUND , & req -> flags )) {
161163 /*
@@ -274,8 +276,9 @@ static void flush_bg_queue(struct fuse_conn *fc)
274276 * the 'end' callback is called if given, else the reference to the
275277 * request is released
276278 */
277- void fuse_request_end (struct fuse_conn * fc , struct fuse_req * req )
279+ void fuse_request_end (struct fuse_req * req )
278280{
281+ struct fuse_conn * fc = req -> fc ;
279282 struct fuse_iqueue * fiq = & fc -> iq ;
280283
281284 if (test_and_set_bit (FR_FINISHED , & req -> flags ))
@@ -326,12 +329,14 @@ void fuse_request_end(struct fuse_conn *fc, struct fuse_req *req)
326329 if (test_bit (FR_ASYNC , & req -> flags ))
327330 req -> args -> end (fc , req -> args , req -> out .h .error );
328331put_request :
329- fuse_put_request (fc , req );
332+ fuse_put_request (req );
330333}
331334EXPORT_SYMBOL_GPL (fuse_request_end );
332335
333- static int queue_interrupt (struct fuse_iqueue * fiq , struct fuse_req * req )
336+ static int queue_interrupt (struct fuse_req * req )
334337{
338+ struct fuse_iqueue * fiq = & req -> fc -> iq ;
339+
335340 spin_lock (& fiq -> lock );
336341 /* Check for we've sent request to interrupt this req */
337342 if (unlikely (!test_bit (FR_INTERRUPTED , & req -> flags ))) {
@@ -358,8 +363,9 @@ static int queue_interrupt(struct fuse_iqueue *fiq, struct fuse_req *req)
358363 return 0 ;
359364}
360365
361- static void request_wait_answer (struct fuse_conn * fc , struct fuse_req * req )
366+ static void request_wait_answer (struct fuse_req * req )
362367{
368+ struct fuse_conn * fc = req -> fc ;
363369 struct fuse_iqueue * fiq = & fc -> iq ;
364370 int err ;
365371
@@ -374,7 +380,7 @@ static void request_wait_answer(struct fuse_conn *fc, struct fuse_req *req)
374380 /* matches barrier in fuse_dev_do_read() */
375381 smp_mb__after_atomic ();
376382 if (test_bit (FR_SENT , & req -> flags ))
377- queue_interrupt (fiq , req );
383+ queue_interrupt (req );
378384 }
379385
380386 if (!test_bit (FR_FORCE , & req -> flags )) {
@@ -403,9 +409,9 @@ static void request_wait_answer(struct fuse_conn *fc, struct fuse_req *req)
403409 wait_event (req -> waitq , test_bit (FR_FINISHED , & req -> flags ));
404410}
405411
406- static void __fuse_request_send (struct fuse_conn * fc , struct fuse_req * req )
412+ static void __fuse_request_send (struct fuse_req * req )
407413{
408- struct fuse_iqueue * fiq = & fc -> iq ;
414+ struct fuse_iqueue * fiq = & req -> fc -> iq ;
409415
410416 BUG_ON (test_bit (FR_BACKGROUND , & req -> flags ));
411417 spin_lock (& fiq -> lock );
@@ -419,7 +425,7 @@ static void __fuse_request_send(struct fuse_conn *fc, struct fuse_req *req)
419425 __fuse_get_request (req );
420426 queue_request_and_unlock (fiq , req );
421427
422- request_wait_answer (fc , req );
428+ request_wait_answer (req );
423429 /* Pairs with smp_wmb() in fuse_request_end() */
424430 smp_rmb ();
425431 }
@@ -458,8 +464,10 @@ static void fuse_adjust_compat(struct fuse_conn *fc, struct fuse_args *args)
458464 }
459465}
460466
461- static void fuse_force_creds (struct fuse_conn * fc , struct fuse_req * req )
467+ static void fuse_force_creds (struct fuse_req * req )
462468{
469+ struct fuse_conn * fc = req -> fc ;
470+
463471 req -> in .h .uid = from_kuid_munged (fc -> user_ns , current_fsuid ());
464472 req -> in .h .gid = from_kgid_munged (fc -> user_ns , current_fsgid ());
465473 req -> in .h .pid = pid_nr_ns (task_pid (current ), fc -> pid_ns );
@@ -484,7 +492,7 @@ ssize_t fuse_simple_request(struct fuse_conn *fc, struct fuse_args *args)
484492 req = fuse_request_alloc (fc , GFP_KERNEL | __GFP_NOFAIL );
485493
486494 if (!args -> nocreds )
487- fuse_force_creds (fc , req );
495+ fuse_force_creds (req );
488496
489497 __set_bit (FR_WAITING , & req -> flags );
490498 __set_bit (FR_FORCE , & req -> flags );
@@ -501,20 +509,20 @@ ssize_t fuse_simple_request(struct fuse_conn *fc, struct fuse_args *args)
501509
502510 if (!args -> noreply )
503511 __set_bit (FR_ISREPLY , & req -> flags );
504- __fuse_request_send (fc , req );
512+ __fuse_request_send (req );
505513 ret = req -> out .h .error ;
506514 if (!ret && args -> out_argvar ) {
507515 BUG_ON (args -> out_numargs == 0 );
508516 ret = args -> out_args [args -> out_numargs - 1 ].size ;
509517 }
510- fuse_put_request (fc , req );
518+ fuse_put_request (req );
511519
512520 return ret ;
513521}
514522
515- static bool fuse_request_queue_background (struct fuse_conn * fc ,
516- struct fuse_req * req )
523+ static bool fuse_request_queue_background (struct fuse_req * req )
517524{
525+ struct fuse_conn * fc = req -> fc ;
518526 bool queued = false;
519527
520528 WARN_ON (!test_bit (FR_BACKGROUND , & req -> flags ));
@@ -561,8 +569,8 @@ int fuse_simple_background(struct fuse_conn *fc, struct fuse_args *args,
561569
562570 fuse_args_to_req (req , args );
563571
564- if (!fuse_request_queue_background (fc , req )) {
565- fuse_put_request (fc , req );
572+ if (!fuse_request_queue_background (req )) {
573+ fuse_put_request (req );
566574 return - ENOTCONN ;
567575 }
568576
@@ -592,7 +600,7 @@ static int fuse_simple_notify_reply(struct fuse_conn *fc,
592600 } else {
593601 err = - ENODEV ;
594602 spin_unlock (& fiq -> lock );
595- fuse_put_request (fc , req );
603+ fuse_put_request (req );
596604 }
597605
598606 return err ;
@@ -1259,7 +1267,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file,
12591267 /* SETXATTR is special, since it may contain too large data */
12601268 if (args -> opcode == FUSE_SETXATTR )
12611269 req -> out .h .error = - E2BIG ;
1262- fuse_request_end (fc , req );
1270+ fuse_request_end (req );
12631271 goto restart ;
12641272 }
12651273 spin_lock (& fpq -> lock );
@@ -1293,16 +1301,16 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file,
12931301 /* matches barrier in request_wait_answer() */
12941302 smp_mb__after_atomic ();
12951303 if (test_bit (FR_INTERRUPTED , & req -> flags ))
1296- queue_interrupt (fiq , req );
1297- fuse_put_request (fc , req );
1304+ queue_interrupt (req );
1305+ fuse_put_request (req );
12981306
12991307 return reqsize ;
13001308
13011309out_end :
13021310 if (!test_bit (FR_PRIVATE , & req -> flags ))
13031311 list_del_init (& req -> list );
13041312 spin_unlock (& fpq -> lock );
1305- fuse_request_end (fc , req );
1313+ fuse_request_end (req );
13061314 return err ;
13071315
13081316 err_unlock :
@@ -1884,9 +1892,9 @@ static ssize_t fuse_dev_do_write(struct fuse_dev *fud,
18841892 else if (oh .error == - ENOSYS )
18851893 fc -> no_interrupt = 1 ;
18861894 else if (oh .error == - EAGAIN )
1887- err = queue_interrupt (& fc -> iq , req );
1895+ err = queue_interrupt (req );
18881896
1889- fuse_put_request (fc , req );
1897+ fuse_put_request (req );
18901898
18911899 goto copy_finish ;
18921900 }
@@ -1916,7 +1924,7 @@ static ssize_t fuse_dev_do_write(struct fuse_dev *fud,
19161924 list_del_init (& req -> list );
19171925 spin_unlock (& fpq -> lock );
19181926
1919- fuse_request_end (fc , req );
1927+ fuse_request_end (req );
19201928out :
19211929 return err ? err : nbytes ;
19221930
@@ -2054,15 +2062,15 @@ static __poll_t fuse_dev_poll(struct file *file, poll_table *wait)
20542062}
20552063
20562064/* Abort all requests on the given list (pending or processing) */
2057- static void end_requests (struct fuse_conn * fc , struct list_head * head )
2065+ static void end_requests (struct list_head * head )
20582066{
20592067 while (!list_empty (head )) {
20602068 struct fuse_req * req ;
20612069 req = list_entry (head -> next , struct fuse_req , list );
20622070 req -> out .h .error = - ECONNABORTED ;
20632071 clear_bit (FR_SENT , & req -> flags );
20642072 list_del_init (& req -> list );
2065- fuse_request_end (fc , req );
2073+ fuse_request_end (req );
20662074 }
20672075}
20682076
@@ -2157,7 +2165,7 @@ void fuse_abort_conn(struct fuse_conn *fc)
21572165 wake_up_all (& fc -> blocked_waitq );
21582166 spin_unlock (& fc -> lock );
21592167
2160- end_requests (fc , & to_end );
2168+ end_requests (& to_end );
21612169 } else {
21622170 spin_unlock (& fc -> lock );
21632171 }
@@ -2187,7 +2195,7 @@ int fuse_dev_release(struct inode *inode, struct file *file)
21872195 list_splice_init (& fpq -> processing [i ], & to_end );
21882196 spin_unlock (& fpq -> lock );
21892197
2190- end_requests (fc , & to_end );
2198+ end_requests (& to_end );
21912199
21922200 /* Are we the last open device? */
21932201 if (atomic_dec_and_test (& fc -> dev_count )) {
0 commit comments