Commit c5ea306
smb: client: fix data loss due to broken rename(2)
Rename of open files in SMB2+ has been broken for a very long time,
resulting in data loss as the CIFS client would fail the rename(2)
call with -ENOENT and then removing the target file.
Fix this by implementing ->rename_pending_delete() for SMB2+, which
will rename busy files to random filenames (e.g. silly rename) during
unlink(2) or rename(2), and then marking them to delete-on-close.
Besides, introduce a FIND_WR_NO_PENDING_DELETE flag to prevent open(2)
from reusing open handles that had been marked as delete pending.
Handle it in cifs_get_readable_path() as well.
Reported-by: Jean-Baptiste Denis <jbdenis@pasteur.fr>
Closes: https://marc.info/?i=16aeb380-30d4-4551-9134-4e7d1dc833c0@pasteur.fr
Reviewed-by: David Howells <dhowells@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
Cc: Frank Sorenson <sorenson@redhat.com>
Cc: Olga Kornievskaia <okorniev@redhat.com>
Cc: Benjamin Coddington <bcodding@redhat.com>
Cc: Scott Mayhew <smayhew@redhat.com>
Cc: linux-cifs@vger.kernel.org
Signed-off-by: Steve French <stfrench@microsoft.com>1 parent 90f7c10 commit c5ea306
File tree
8 files changed
+268
-72
lines changed- fs/smb/client
8 files changed
+268
-72
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
1882 | 1882 | | |
1883 | 1883 | | |
1884 | 1884 | | |
1885 | | - | |
1886 | | - | |
1887 | | - | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
1888 | 1891 | | |
1889 | 1892 | | |
1890 | 1893 | | |
| |||
2343 | 2346 | | |
2344 | 2347 | | |
2345 | 2348 | | |
| 2349 | + | |
| 2350 | + | |
2346 | 2351 | | |
2347 | 2352 | | |
2348 | 2353 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
998 | 998 | | |
999 | 999 | | |
1000 | 1000 | | |
1001 | | - | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
1002 | 1005 | | |
1003 | 1006 | | |
1004 | 1007 | | |
| |||
2530 | 2533 | | |
2531 | 2534 | | |
2532 | 2535 | | |
| 2536 | + | |
| 2537 | + | |
| 2538 | + | |
2533 | 2539 | | |
2534 | 2540 | | |
2535 | 2541 | | |
| |||
2647 | 2653 | | |
2648 | 2654 | | |
2649 | 2655 | | |
| 2656 | + | |
| 2657 | + | |
| 2658 | + | |
| 2659 | + | |
| 2660 | + | |
| 2661 | + | |
| 2662 | + | |
| 2663 | + | |
| 2664 | + | |
| 2665 | + | |
2650 | 2666 | | |
2651 | 2667 | | |
2652 | 2668 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1931 | 1931 | | |
1932 | 1932 | | |
1933 | 1933 | | |
1934 | | - | |
| 1934 | + | |
1935 | 1935 | | |
1936 | 1936 | | |
1937 | 1937 | | |
| |||
2003 | 2003 | | |
2004 | 2004 | | |
2005 | 2005 | | |
2006 | | - | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
2007 | 2011 | | |
2008 | 2012 | | |
2009 | 2013 | | |
| |||
2071 | 2075 | | |
2072 | 2076 | | |
2073 | 2077 | | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
| 2082 | + | |
2074 | 2083 | | |
2075 | 2084 | | |
2076 | 2085 | | |
| |||
2358 | 2367 | | |
2359 | 2368 | | |
2360 | 2369 | | |
| 2370 | + | |
| 2371 | + | |
2361 | 2372 | | |
| 2373 | + | |
2362 | 2374 | | |
2363 | 2375 | | |
2364 | 2376 | | |
2365 | 2377 | | |
2366 | 2378 | | |
2367 | 2379 | | |
2368 | | - | |
2369 | 2380 | | |
2370 | 2381 | | |
2371 | 2382 | | |
| |||
2458 | 2469 | | |
2459 | 2470 | | |
2460 | 2471 | | |
2461 | | - | |
| 2472 | + | |
2462 | 2473 | | |
| 2474 | + | |
| 2475 | + | |
| 2476 | + | |
2463 | 2477 | | |
2464 | 2478 | | |
2465 | 2479 | | |
| |||
2470 | 2484 | | |
2471 | 2485 | | |
2472 | 2486 | | |
| 2487 | + | |
2473 | 2488 | | |
2474 | 2489 | | |
2475 | 2490 | | |
| |||
2505 | 2520 | | |
2506 | 2521 | | |
2507 | 2522 | | |
| 2523 | + | |
2508 | 2524 | | |
2509 | 2525 | | |
2510 | 2526 | | |
| |||
2591 | 2607 | | |
2592 | 2608 | | |
2593 | 2609 | | |
2594 | | - | |
2595 | | - | |
2596 | | - | |
2597 | | - | |
2598 | | - | |
2599 | | - | |
2600 | | - | |
2601 | | - | |
2602 | | - | |
2603 | | - | |
2604 | | - | |
2605 | | - | |
2606 | | - | |
| 2610 | + | |
| 2611 | + | |
| 2612 | + | |
| 2613 | + | |
| 2614 | + | |
| 2615 | + | |
| 2616 | + | |
| 2617 | + | |
| 2618 | + | |
| 2619 | + | |
| 2620 | + | |
| 2621 | + | |
| 2622 | + | |
| 2623 | + | |
| 2624 | + | |
| 2625 | + | |
| 2626 | + | |
| 2627 | + | |
| 2628 | + | |
| 2629 | + | |
| 2630 | + | |
| 2631 | + | |
| 2632 | + | |
| 2633 | + | |
| 2634 | + | |
| 2635 | + | |
| 2636 | + | |
| 2637 | + | |
| 2638 | + | |
| 2639 | + | |
| 2640 | + | |
| 2641 | + | |
| 2642 | + | |
| 2643 | + | |
| 2644 | + | |
| 2645 | + | |
| 2646 | + | |
| 2647 | + | |
| 2648 | + | |
| 2649 | + | |
| 2650 | + | |
| 2651 | + | |
| 2652 | + | |
| 2653 | + | |
| 2654 | + | |
| 2655 | + | |
| 2656 | + | |
2607 | 2657 | | |
2608 | 2658 | | |
2609 | 2659 | | |
| |||
2629 | 2679 | | |
2630 | 2680 | | |
2631 | 2681 | | |
| 2682 | + | |
| 2683 | + | |
2632 | 2684 | | |
2633 | 2685 | | |
2634 | 2686 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | 33 | | |
35 | 34 | | |
36 | | - | |
| 35 | + | |
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
| |||
0 commit comments