Commit 617fdf8
committed
smb: client: fix data loss due to broken rename(2)
jira LE-4603
Rebuild_History Non-Buildable kernel-5.14.0-570.58.1.el9_6
commit-author Paulo Alcantara <pc@manguebit.org>
commit c5ea306
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>
(cherry picked from commit c5ea306)
Signed-off-by: Jonathan Maple <jmaple@ciq.com>1 parent f8ca85c commit 617fdf8
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 | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| |||
1921 | 1921 | | |
1922 | 1922 | | |
1923 | 1923 | | |
1924 | | - | |
1925 | | - | |
1926 | | - | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
1927 | 1930 | | |
1928 | 1931 | | |
1929 | 1932 | | |
| |||
2357 | 2360 | | |
2358 | 2361 | | |
2359 | 2362 | | |
| 2363 | + | |
| 2364 | + | |
2360 | 2365 | | |
2361 | 2366 | | |
2362 | 2367 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
680 | 680 | | |
681 | 681 | | |
682 | 682 | | |
683 | | - | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
684 | 687 | | |
685 | 688 | | |
686 | 689 | | |
| |||
2285 | 2288 | | |
2286 | 2289 | | |
2287 | 2290 | | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
2288 | 2294 | | |
2289 | 2295 | | |
2290 | 2296 | | |
| |||
2402 | 2408 | | |
2403 | 2409 | | |
2404 | 2410 | | |
| 2411 | + | |
| 2412 | + | |
| 2413 | + | |
| 2414 | + | |
| 2415 | + | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
2405 | 2421 | | |
2406 | 2422 | | |
2407 | 2423 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1890 | 1890 | | |
1891 | 1891 | | |
1892 | 1892 | | |
1893 | | - | |
| 1893 | + | |
1894 | 1894 | | |
1895 | 1895 | | |
1896 | 1896 | | |
| |||
1961 | 1961 | | |
1962 | 1962 | | |
1963 | 1963 | | |
1964 | | - | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
1965 | 1969 | | |
1966 | 1970 | | |
1967 | 1971 | | |
| |||
2029 | 2033 | | |
2030 | 2034 | | |
2031 | 2035 | | |
| 2036 | + | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
2032 | 2041 | | |
2033 | 2042 | | |
2034 | 2043 | | |
| |||
2316 | 2325 | | |
2317 | 2326 | | |
2318 | 2327 | | |
| 2328 | + | |
| 2329 | + | |
2319 | 2330 | | |
| 2331 | + | |
2320 | 2332 | | |
2321 | 2333 | | |
2322 | 2334 | | |
2323 | 2335 | | |
2324 | 2336 | | |
2325 | 2337 | | |
2326 | | - | |
2327 | 2338 | | |
2328 | 2339 | | |
2329 | 2340 | | |
| |||
2416 | 2427 | | |
2417 | 2428 | | |
2418 | 2429 | | |
2419 | | - | |
| 2430 | + | |
2420 | 2431 | | |
| 2432 | + | |
| 2433 | + | |
| 2434 | + | |
2421 | 2435 | | |
2422 | 2436 | | |
2423 | 2437 | | |
| |||
2428 | 2442 | | |
2429 | 2443 | | |
2430 | 2444 | | |
| 2445 | + | |
2431 | 2446 | | |
2432 | 2447 | | |
2433 | 2448 | | |
| |||
2463 | 2478 | | |
2464 | 2479 | | |
2465 | 2480 | | |
| 2481 | + | |
2466 | 2482 | | |
2467 | 2483 | | |
2468 | 2484 | | |
| |||
2547 | 2563 | | |
2548 | 2564 | | |
2549 | 2565 | | |
2550 | | - | |
2551 | | - | |
2552 | | - | |
2553 | | - | |
2554 | | - | |
2555 | | - | |
2556 | | - | |
2557 | | - | |
2558 | | - | |
2559 | | - | |
2560 | | - | |
2561 | | - | |
2562 | | - | |
| 2566 | + | |
| 2567 | + | |
| 2568 | + | |
| 2569 | + | |
| 2570 | + | |
| 2571 | + | |
| 2572 | + | |
| 2573 | + | |
| 2574 | + | |
| 2575 | + | |
| 2576 | + | |
| 2577 | + | |
| 2578 | + | |
| 2579 | + | |
| 2580 | + | |
| 2581 | + | |
| 2582 | + | |
| 2583 | + | |
| 2584 | + | |
| 2585 | + | |
| 2586 | + | |
| 2587 | + | |
| 2588 | + | |
| 2589 | + | |
| 2590 | + | |
| 2591 | + | |
| 2592 | + | |
| 2593 | + | |
| 2594 | + | |
| 2595 | + | |
| 2596 | + | |
| 2597 | + | |
| 2598 | + | |
| 2599 | + | |
| 2600 | + | |
| 2601 | + | |
| 2602 | + | |
| 2603 | + | |
| 2604 | + | |
| 2605 | + | |
| 2606 | + | |
| 2607 | + | |
| 2608 | + | |
| 2609 | + | |
| 2610 | + | |
| 2611 | + | |
| 2612 | + | |
2563 | 2613 | | |
2564 | 2614 | | |
2565 | 2615 | | |
| |||
2588 | 2638 | | |
2589 | 2639 | | |
2590 | 2640 | | |
| 2641 | + | |
| 2642 | + | |
2591 | 2643 | | |
2592 | 2644 | | |
2593 | 2645 | | |
| |||
| 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