diff options
| -rw-r--r-- | fs/ntfs/ChangeLog | 5 | ||||
| -rw-r--r-- | fs/ntfs/aops.c | 41 |
2 files changed, 26 insertions, 20 deletions
diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog index 7f24cb19c69e..c3b510210743 100644 --- a/fs/ntfs/ChangeLog +++ b/fs/ntfs/ChangeLog | |||
| @@ -76,11 +76,10 @@ ToDo/Notes: | |||
| 76 | - Truncate {a,c,m}time to the ntfs supported time granularity when | 76 | - Truncate {a,c,m}time to the ntfs supported time granularity when |
| 77 | updating the times in the inode in ntfs_setattr(). | 77 | updating the times in the inode in ntfs_setattr(). |
| 78 | - Fixup handling of sparse, compressed, and encrypted attributes in | 78 | - Fixup handling of sparse, compressed, and encrypted attributes in |
| 79 | fs/ntfs/inode.c::ntfs_read_locked_{,attr_,index_}inode(). | 79 | fs/ntfs/inode.c::ntfs_read_locked_{,attr_,index_}inode(), |
| 80 | fs/ntfs/aops.c::ntfs_{read,write}page(). | ||
| 80 | - Make ntfs_write_block() not instantiate sparse blocks if they contain | 81 | - Make ntfs_write_block() not instantiate sparse blocks if they contain |
| 81 | only zeroes. | 82 | only zeroes. |
| 82 | - Fixup handling of sparse, compressed, and encrypted attributes in | ||
| 83 | fs/ntfs/aops.c::ntfs_writepage(). | ||
| 84 | - Optimize fs/ntfs/aops.c::ntfs_write_block() by extending the page | 83 | - Optimize fs/ntfs/aops.c::ntfs_write_block() by extending the page |
| 85 | lock protection over the buffer submission for i/o which allows the | 84 | lock protection over the buffer submission for i/o which allows the |
| 86 | removal of the get_bh()/put_bh() pairs for each buffer. | 85 | removal of the get_bh()/put_bh() pairs for each buffer. |
diff --git a/fs/ntfs/aops.c b/fs/ntfs/aops.c index 59389a8801bc..2482b677a82a 100644 --- a/fs/ntfs/aops.c +++ b/fs/ntfs/aops.c | |||
| @@ -379,31 +379,38 @@ retry_readpage: | |||
| 379 | return 0; | 379 | return 0; |
| 380 | } | 380 | } |
| 381 | ni = NTFS_I(page->mapping->host); | 381 | ni = NTFS_I(page->mapping->host); |
| 382 | 382 | /* | |
| 383 | * Only $DATA attributes can be encrypted and only unnamed $DATA | ||
| 384 | * attributes can be compressed. Index root can have the flags set but | ||
| 385 | * this means to create compressed/encrypted files, not that the | ||
| 386 | * attribute is compressed/encrypted. | ||
| 387 | */ | ||
| 388 | if (ni->type != AT_INDEX_ROOT) { | ||
| 389 | /* If attribute is encrypted, deny access, just like NT4. */ | ||
| 390 | if (NInoEncrypted(ni)) { | ||
| 391 | BUG_ON(ni->type != AT_DATA); | ||
| 392 | err = -EACCES; | ||
| 393 | goto err_out; | ||
| 394 | } | ||
| 395 | /* Compressed data streams are handled in compress.c. */ | ||
| 396 | if (NInoNonResident(ni) && NInoCompressed(ni)) { | ||
| 397 | BUG_ON(ni->type != AT_DATA); | ||
| 398 | BUG_ON(ni->name_len); | ||
| 399 | return ntfs_read_compressed_block(page); | ||
| 400 | } | ||
| 401 | } | ||
| 383 | /* NInoNonResident() == NInoIndexAllocPresent() */ | 402 | /* NInoNonResident() == NInoIndexAllocPresent() */ |
| 384 | if (NInoNonResident(ni)) { | 403 | if (NInoNonResident(ni)) { |
| 385 | /* | 404 | /* Normal, non-resident data stream. */ |
| 386 | * Only unnamed $DATA attributes can be compressed or | ||
| 387 | * encrypted. | ||
| 388 | */ | ||
| 389 | if (ni->type == AT_DATA && !ni->name_len) { | ||
| 390 | /* If file is encrypted, deny access, just like NT4. */ | ||
| 391 | if (NInoEncrypted(ni)) { | ||
| 392 | err = -EACCES; | ||
| 393 | goto err_out; | ||
| 394 | } | ||
| 395 | /* Compressed data streams are handled in compress.c. */ | ||
| 396 | if (NInoCompressed(ni)) | ||
| 397 | return ntfs_read_compressed_block(page); | ||
| 398 | } | ||
| 399 | /* Normal data stream. */ | ||
| 400 | return ntfs_read_block(page); | 405 | return ntfs_read_block(page); |
| 401 | } | 406 | } |
| 402 | /* | 407 | /* |
| 403 | * Attribute is resident, implying it is not compressed or encrypted. | 408 | * Attribute is resident, implying it is not compressed or encrypted. |
| 404 | * This also means the attribute is smaller than an mft record and | 409 | * This also means the attribute is smaller than an mft record and |
| 405 | * hence smaller than a page, so can simply zero out any pages with | 410 | * hence smaller than a page, so can simply zero out any pages with |
| 406 | * index above 0. | 411 | * index above 0. Note the attribute can actually be marked compressed |
| 412 | * but if it is resident the actual data is not compressed so we are | ||
| 413 | * ok to ignore the compressed flag here. | ||
| 407 | */ | 414 | */ |
| 408 | if (unlikely(page->index > 0)) { | 415 | if (unlikely(page->index > 0)) { |
| 409 | kaddr = kmap_atomic(page, KM_USER0); | 416 | kaddr = kmap_atomic(page, KM_USER0); |
