@@ -259,9 +259,7 @@ static void cachefiles_write_complete(struct kiocb *iocb, long ret)
259
259
260
260
_enter ("%ld" , ret );
261
261
262
- /* Tell lockdep we inherited freeze protection from submission thread */
263
- __sb_writers_acquired (inode -> i_sb , SB_FREEZE_WRITE );
264
- __sb_end_write (inode -> i_sb , SB_FREEZE_WRITE );
262
+ kiocb_end_write (iocb );
265
263
266
264
if (ret < 0 )
267
265
trace_cachefiles_io_error (object , inode , ret ,
@@ -286,7 +284,6 @@ int __cachefiles_write(struct cachefiles_object *object,
286
284
{
287
285
struct cachefiles_cache * cache ;
288
286
struct cachefiles_kiocb * ki ;
289
- struct inode * inode ;
290
287
unsigned int old_nofs ;
291
288
ssize_t ret ;
292
289
size_t len = iov_iter_count (iter );
@@ -322,19 +319,12 @@ int __cachefiles_write(struct cachefiles_object *object,
322
319
ki -> iocb .ki_complete = cachefiles_write_complete ;
323
320
atomic_long_add (ki -> b_writing , & cache -> b_writing );
324
321
325
- /* Open-code file_start_write here to grab freeze protection, which
326
- * will be released by another thread in aio_complete_rw(). Fool
327
- * lockdep by telling it the lock got released so that it doesn't
328
- * complain about the held lock when we return to userspace.
329
- */
330
- inode = file_inode (file );
331
- __sb_start_write (inode -> i_sb , SB_FREEZE_WRITE );
332
- __sb_writers_release (inode -> i_sb , SB_FREEZE_WRITE );
322
+ kiocb_start_write (& ki -> iocb );
333
323
334
324
get_file (ki -> iocb .ki_filp );
335
325
cachefiles_grab_object (object , cachefiles_obj_get_ioreq );
336
326
337
- trace_cachefiles_write (object , inode , ki -> iocb .ki_pos , len );
327
+ trace_cachefiles_write (object , file_inode ( file ) , ki -> iocb .ki_pos , len );
338
328
old_nofs = memalloc_nofs_save ();
339
329
ret = cachefiles_inject_write_error ();
340
330
if (ret == 0 )
0 commit comments