Skip to content

Commit e43f6ec

Browse files
fs/ntfs3: Print details about mount fails
Added error mesages with error codes. Minor refactoring and code formatting. Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
1 parent 16b3dbf commit e43f6ec

3 files changed

Lines changed: 122 additions & 92 deletions

File tree

fs/ntfs3/frecord.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3360,7 +3360,7 @@ int ni_write_inode(struct inode *inode, int sync, const char *hint)
33603360
ni_unlock(ni);
33613361

33623362
if (err) {
3363-
ntfs_err(sb, "%s r=%lx failed, %d.", hint, inode->i_ino, err);
3363+
ntfs_inode_err(inode, "%s failed, %d.", hint, err);
33643364
ntfs_set_state(sbi, NTFS_DIRTY_ERROR);
33653365
return err;
33663366
}

fs/ntfs3/fsntfs.c

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ int ntfs_extend_init(struct ntfs_sb_info *sbi)
223223
inode = ntfs_iget5(sb, &ref, &NAME_EXTEND);
224224
if (IS_ERR(inode)) {
225225
err = PTR_ERR(inode);
226-
ntfs_err(sb, "Failed to load $Extend.");
226+
ntfs_err(sb, "Failed to load $Extend (%d).", err);
227227
inode = NULL;
228228
goto out;
229229
}
@@ -282,7 +282,7 @@ int ntfs_loadlog_and_replay(struct ntfs_inode *ni, struct ntfs_sb_info *sbi)
282282

283283
/* Check for 4GB. */
284284
if (ni->vfs_inode.i_size >= 0x100000000ull) {
285-
ntfs_err(sb, "\x24LogFile is too big");
285+
ntfs_err(sb, "\x24LogFile is large than 4G.");
286286
err = -EINVAL;
287287
goto out;
288288
}
@@ -1863,7 +1863,7 @@ int ntfs_security_init(struct ntfs_sb_info *sbi)
18631863
inode = ntfs_iget5(sb, &ref, &NAME_SECURE);
18641864
if (IS_ERR(inode)) {
18651865
err = PTR_ERR(inode);
1866-
ntfs_err(sb, "Failed to load $Secure.");
1866+
ntfs_err(sb, "Failed to load $Secure (%d).", err);
18671867
inode = NULL;
18681868
goto out;
18691869
}
@@ -1874,45 +1874,43 @@ int ntfs_security_init(struct ntfs_sb_info *sbi)
18741874

18751875
attr = ni_find_attr(ni, NULL, &le, ATTR_ROOT, SDH_NAME,
18761876
ARRAY_SIZE(SDH_NAME), NULL, NULL);
1877-
if (!attr) {
1878-
err = -EINVAL;
1879-
goto out;
1880-
}
1881-
1882-
if(!(root_sdh = resident_data_ex(attr, sizeof(struct INDEX_ROOT))) ||
1877+
if (!attr ||
1878+
!(root_sdh = resident_data_ex(attr, sizeof(struct INDEX_ROOT))) ||
18831879
root_sdh->type != ATTR_ZERO ||
18841880
root_sdh->rule != NTFS_COLLATION_TYPE_SECURITY_HASH ||
18851881
offsetof(struct INDEX_ROOT, ihdr) +
1886-
le32_to_cpu(root_sdh->ihdr.used) >
1887-
le32_to_cpu(attr->res.data_size)) {
1882+
le32_to_cpu(root_sdh->ihdr.used) >
1883+
le32_to_cpu(attr->res.data_size)) {
1884+
ntfs_err(sb, "$Secure::$SDH is corrupted.");
18881885
err = -EINVAL;
18891886
goto out;
18901887
}
18911888

18921889
err = indx_init(indx_sdh, sbi, attr, INDEX_MUTEX_SDH);
1893-
if (err)
1890+
if (err) {
1891+
ntfs_err(sb, "Failed to initialize $Secure::$SDH (%d).", err);
18941892
goto out;
1893+
}
18951894

18961895
attr = ni_find_attr(ni, attr, &le, ATTR_ROOT, SII_NAME,
18971896
ARRAY_SIZE(SII_NAME), NULL, NULL);
1898-
if (!attr) {
1899-
err = -EINVAL;
1900-
goto out;
1901-
}
1902-
1903-
if(!(root_sii = resident_data_ex(attr, sizeof(struct INDEX_ROOT))) ||
1897+
if (!attr ||
1898+
!(root_sii = resident_data_ex(attr, sizeof(struct INDEX_ROOT))) ||
19041899
root_sii->type != ATTR_ZERO ||
19051900
root_sii->rule != NTFS_COLLATION_TYPE_UINT ||
19061901
offsetof(struct INDEX_ROOT, ihdr) +
1907-
le32_to_cpu(root_sii->ihdr.used) >
1908-
le32_to_cpu(attr->res.data_size)) {
1902+
le32_to_cpu(root_sii->ihdr.used) >
1903+
le32_to_cpu(attr->res.data_size)) {
1904+
ntfs_err(sb, "$Secure::$SII is corrupted.");
19091905
err = -EINVAL;
19101906
goto out;
19111907
}
19121908

19131909
err = indx_init(indx_sii, sbi, attr, INDEX_MUTEX_SII);
1914-
if (err)
1910+
if (err) {
1911+
ntfs_err(sb, "Failed to initialize $Secure::$SII (%d).", err);
19151912
goto out;
1913+
}
19161914

19171915
fnd_sii = fnd_get();
19181916
if (!fnd_sii) {

0 commit comments

Comments
 (0)