diff options
| author | Jan Kara <jack@suse.cz> | 2014-09-04 10:19:47 -0400 |
|---|---|---|
| committer | Jan Kara <jack@suse.cz> | 2014-09-04 15:37:39 -0400 |
| commit | 4071b913622316970d0e1919f7d82b4403fec5f2 (patch) | |
| tree | 0e595eaf47564dcb514009f678623171a9b2ce55 | |
| parent | 6d3d5e860a114ae606b1af2ba7f64cb19fbeb414 (diff) | |
udf: Properly detect stale inodes
NFS can easily ask for inodes that are already deleted. Currently UDF
happily returns such inodes which is a bug. Return -ESTALE if
udf_read_inode() is asked to read deleted inode.
Signed-off-by: Jan Kara <jack@suse.cz>
| -rw-r--r-- | fs/udf/inode.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 788fc58ea78e..3a44d9187aad 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
| @@ -1435,8 +1435,10 @@ reread: | |||
| 1435 | read_unlock(&sbi->s_cred_lock); | 1435 | read_unlock(&sbi->s_cred_lock); |
| 1436 | 1436 | ||
| 1437 | link_count = le16_to_cpu(fe->fileLinkCount); | 1437 | link_count = le16_to_cpu(fe->fileLinkCount); |
| 1438 | if (!link_count) | 1438 | if (!link_count) { |
| 1439 | link_count = 1; | 1439 | ret = -ESTALE; |
| 1440 | goto out; | ||
| 1441 | } | ||
| 1440 | set_nlink(inode, link_count); | 1442 | set_nlink(inode, link_count); |
| 1441 | 1443 | ||
| 1442 | inode->i_size = le64_to_cpu(fe->informationLength); | 1444 | inode->i_size = le64_to_cpu(fe->informationLength); |
