Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'fuse-fixes-6.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse

Pull fuse fixes from Miklos Szeredi:

- Fix cached size after passthrough writes

This fix needed a trivial change in the backing-file API, which
resulted in some non-fuse files being touched.

- Revert a commit meant as a cleanup but which triggered a WARNING

- Remove a stray debug line left-over

* tag 'fuse-fixes-6.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse:
fuse: remove stray debug line
Revert "fuse: move initialization of fuse_file to fuse_writepages() instead of in callback"
fuse: update inode size after extending passthrough write
fs: pass offset and result to backing_file end_write() callback

+28 -18
+4 -4
fs/backing-file.c
··· 80 80 refcount_t ref; 81 81 struct kiocb *orig_iocb; 82 82 /* used for aio completion */ 83 - void (*end_write)(struct file *); 83 + void (*end_write)(struct file *, loff_t, ssize_t); 84 84 struct work_struct work; 85 85 long res; 86 86 }; ··· 109 109 struct kiocb *orig_iocb = aio->orig_iocb; 110 110 111 111 if (aio->end_write) 112 - aio->end_write(orig_iocb->ki_filp); 112 + aio->end_write(orig_iocb->ki_filp, iocb->ki_pos, res); 113 113 114 114 orig_iocb->ki_pos = iocb->ki_pos; 115 115 backing_aio_put(aio); ··· 239 239 240 240 ret = vfs_iter_write(file, iter, &iocb->ki_pos, rwf); 241 241 if (ctx->end_write) 242 - ctx->end_write(ctx->user_file); 242 + ctx->end_write(ctx->user_file, iocb->ki_pos, ret); 243 243 } else { 244 244 struct backing_aio *aio; 245 245 ··· 317 317 revert_creds(old_cred); 318 318 319 319 if (ctx->end_write) 320 - ctx->end_write(ctx->user_file); 320 + ctx->end_write(ctx->user_file, ppos ? *ppos : 0, ret); 321 321 322 322 return ret; 323 323 }
+12 -6
fs/fuse/file.c
··· 2288 2288 struct folio *tmp_folio; 2289 2289 int err; 2290 2290 2291 + if (!data->ff) { 2292 + err = -EIO; 2293 + data->ff = fuse_write_file_get(fi); 2294 + if (!data->ff) 2295 + goto out_unlock; 2296 + } 2297 + 2291 2298 if (wpa && fuse_writepage_need_send(fc, &folio->page, ap, data)) { 2292 2299 fuse_writepages_send(data); 2293 2300 data->wpa = NULL; ··· 2358 2351 struct writeback_control *wbc) 2359 2352 { 2360 2353 struct inode *inode = mapping->host; 2361 - struct fuse_inode *fi = get_fuse_inode(inode); 2362 2354 struct fuse_conn *fc = get_fuse_conn(inode); 2363 2355 struct fuse_fill_wb_data data; 2364 2356 int err; 2365 2357 2358 + err = -EIO; 2366 2359 if (fuse_is_bad(inode)) 2367 - return -EIO; 2360 + goto out; 2368 2361 2369 2362 if (wbc->sync_mode == WB_SYNC_NONE && 2370 2363 fc->num_background >= fc->congestion_threshold) ··· 2372 2365 2373 2366 data.inode = inode; 2374 2367 data.wpa = NULL; 2375 - data.ff = fuse_write_file_get(fi); 2376 - if (!data.ff) 2377 - return -EIO; 2368 + data.ff = NULL; 2378 2369 2379 2370 err = -ENOMEM; 2380 2371 data.orig_pages = kcalloc(fc->max_pages, ··· 2386 2381 WARN_ON(!data.wpa->ia.ap.num_pages); 2387 2382 fuse_writepages_send(&data); 2388 2383 } 2384 + if (data.ff) 2385 + fuse_file_put(data.ff, false); 2389 2386 2390 2387 kfree(data.orig_pages); 2391 2388 out: 2392 - fuse_file_put(data.ff, false); 2393 2389 return err; 2394 2390 } 2395 2391
+4 -5
fs/fuse/passthrough.c
··· 18 18 fuse_invalidate_atime(inode); 19 19 } 20 20 21 - static void fuse_file_modified(struct file *file) 21 + static void fuse_passthrough_end_write(struct file *file, loff_t pos, ssize_t ret) 22 22 { 23 23 struct inode *inode = file_inode(file); 24 24 25 - fuse_invalidate_attr_mask(inode, FUSE_STATX_MODSIZE); 25 + fuse_write_update_attr(inode, pos, ret); 26 26 } 27 27 28 28 ssize_t fuse_passthrough_read_iter(struct kiocb *iocb, struct iov_iter *iter) ··· 63 63 struct backing_file_ctx ctx = { 64 64 .cred = ff->cred, 65 65 .user_file = file, 66 - .end_write = fuse_file_modified, 66 + .end_write = fuse_passthrough_end_write, 67 67 }; 68 68 69 69 pr_debug("%s: backing_file=0x%p, pos=%lld, len=%zu\n", __func__, ··· 110 110 struct backing_file_ctx ctx = { 111 111 .cred = ff->cred, 112 112 .user_file = out, 113 - .end_write = fuse_file_modified, 113 + .end_write = fuse_passthrough_end_write, 114 114 }; 115 115 116 116 pr_debug("%s: backing_file=0x%p, pos=%lld, len=%zu, flags=0x%x\n", __func__, ··· 234 234 goto out; 235 235 236 236 backing_sb = file_inode(file)->i_sb; 237 - pr_info("%s: %x:%pD %i\n", __func__, backing_sb->s_dev, file, backing_sb->s_stack_depth); 238 237 res = -ELOOP; 239 238 if (backing_sb->s_stack_depth >= fc->max_stack_depth) 240 239 goto out_fput;
+7 -2
fs/overlayfs/file.c
··· 231 231 ovl_copyattr(file_inode(file)); 232 232 } 233 233 234 + static void ovl_file_end_write(struct file *file, loff_t pos, ssize_t ret) 235 + { 236 + ovl_file_modified(file); 237 + } 238 + 234 239 static void ovl_file_accessed(struct file *file) 235 240 { 236 241 struct inode *inode, *upperinode; ··· 299 294 struct backing_file_ctx ctx = { 300 295 .cred = ovl_creds(inode->i_sb), 301 296 .user_file = file, 302 - .end_write = ovl_file_modified, 297 + .end_write = ovl_file_end_write, 303 298 }; 304 299 305 300 if (!iov_iter_count(iter)) ··· 369 364 struct backing_file_ctx ctx = { 370 365 .cred = ovl_creds(inode->i_sb), 371 366 .user_file = out, 372 - .end_write = ovl_file_modified, 367 + .end_write = ovl_file_end_write, 373 368 }; 374 369 375 370 inode_lock(inode);
+1 -1
include/linux/backing-file.h
··· 16 16 const struct cred *cred; 17 17 struct file *user_file; 18 18 void (*accessed)(struct file *); 19 - void (*end_write)(struct file *); 19 + void (*end_write)(struct file *, loff_t, ssize_t); 20 20 }; 21 21 22 22 struct file *backing_file_open(const struct path *user_path, int flags,