mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 12:44:11 +08:00
Description for this pull request:
- Fix ftruncate failure when allocating non-contiguous clusters. -----BEGIN PGP SIGNATURE----- iQJKBAABCgA0FiEE6NzKS6Uv/XAAGHgyZwv7A1FEIQgFAmXhiBkWHGxpbmtpbmpl b25Aa2VybmVsLm9yZwAKCRBnC/sDUUQhCFRdD/47DYPGhZPWt4+JamGs3ZR0WX8l 555GnbSjzLmmGUYjEyDsMmJllL7I0gX3Hm2QNOJIce1ETh3a2oSQlp+O+uIJM7zW rQjV8l6u+JZXEvpZwbfIfpyQ2+p6wFgueFC8+HX+VwfiJXw0hKNfqIwugjyRiWUF P1pptVZvsne2d7dUM8nmwedFZClP2GhyFxPqOiAvPd6Yw5s6b2yOj534eU9JSWfp ph/ZVnZOZNwaKUPD57OWYFKb4hLHEDTpjWjpU1jXkdeKCAB9WuJyegJMtznJIaBW DtkDmaUeQLPccWFWlZXOPvZfueJuWU1rxzGCqYBOvP77SPDATxqgFh5yhRj5wqnx Cs//VqFY6fZC6HfXAURvbM6l+NblaH1m6Bm7o7PkbBScju9tyKByqMNGLtHHnH2V y8jD8mFj2wjvwD+6EBdIVD7ddr1M8uyPUpk++gYxklpSDwwzngkqpUItYCv1sKhD tlwyPY5efDXC1e38KWTmbhGh0UACz8pVNPbFZsQ7jVlvKlAoT+/T4SGz4t+4qXpA IEo36PYEznxNZllf5/kTQ/yzVjPuX2K0CVTvNb01nTdGfHE1p8Uvt1nWJr2nRall vSsOswEbJ78O+313+HCWL2WreqlN4yCVhh+cpyinGLZgrQwBMl4uJrgBb0XxwTD6 0PjItbRcF4C+Bo4tGw== =LfJg -----END PGP SIGNATURE----- Merge tag 'exfat-for-6.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat Pull exfat fix from Namjae Jeon: - Fix ftruncate failure when allocating non-contiguous clusters * tag 'exfat-for-6.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat: exfat: fix appending discontinuous clusters to empty file
This commit is contained in:
commit
3aec97e0c7
@ -35,13 +35,18 @@ static int exfat_cont_expand(struct inode *inode, loff_t size)
|
||||
if (new_num_clusters == num_clusters)
|
||||
goto out;
|
||||
|
||||
exfat_chain_set(&clu, ei->start_clu, num_clusters, ei->flags);
|
||||
ret = exfat_find_last_cluster(sb, &clu, &last_clu);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (num_clusters) {
|
||||
exfat_chain_set(&clu, ei->start_clu, num_clusters, ei->flags);
|
||||
ret = exfat_find_last_cluster(sb, &clu, &last_clu);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
clu.dir = last_clu + 1;
|
||||
} else {
|
||||
last_clu = EXFAT_EOF_CLUSTER;
|
||||
clu.dir = EXFAT_EOF_CLUSTER;
|
||||
}
|
||||
|
||||
clu.dir = (last_clu == EXFAT_EOF_CLUSTER) ?
|
||||
EXFAT_EOF_CLUSTER : last_clu + 1;
|
||||
clu.size = 0;
|
||||
clu.flags = ei->flags;
|
||||
|
||||
@ -51,17 +56,19 @@ static int exfat_cont_expand(struct inode *inode, loff_t size)
|
||||
return ret;
|
||||
|
||||
/* Append new clusters to chain */
|
||||
if (clu.flags != ei->flags) {
|
||||
exfat_chain_cont_cluster(sb, ei->start_clu, num_clusters);
|
||||
ei->flags = ALLOC_FAT_CHAIN;
|
||||
}
|
||||
if (clu.flags == ALLOC_FAT_CHAIN)
|
||||
if (exfat_ent_set(sb, last_clu, clu.dir))
|
||||
goto free_clu;
|
||||
if (num_clusters) {
|
||||
if (clu.flags != ei->flags)
|
||||
if (exfat_chain_cont_cluster(sb, ei->start_clu, num_clusters))
|
||||
goto free_clu;
|
||||
|
||||
if (num_clusters == 0)
|
||||
if (clu.flags == ALLOC_FAT_CHAIN)
|
||||
if (exfat_ent_set(sb, last_clu, clu.dir))
|
||||
goto free_clu;
|
||||
} else
|
||||
ei->start_clu = clu.dir;
|
||||
|
||||
ei->flags = clu.flags;
|
||||
|
||||
out:
|
||||
inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
|
||||
/* Expanded range not zeroed, do not update valid_size */
|
||||
|
Loading…
Reference in New Issue
Block a user