+ ocfs2-return-erofs-when-filesystem-becomes-read-only.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: ocfs2: return -EROFS when filesystem becomes read-only
has been added to the -mm tree.  Its filename is
     ocfs2-return-erofs-when-filesystem-becomes-read-only.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/ocfs2-return-erofs-when-filesystem-becomes-read-only.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/ocfs2-return-erofs-when-filesystem-becomes-read-only.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: piaojun <piaojun@xxxxxxxxxx>
Subject: ocfs2: return -EROFS when filesystem becomes read-only

We should return -EROFS rather than other errno if filesystem becomes
read-only.

Link: http://lkml.kernel.org/r/5B191B26.9010501@xxxxxxxxxx
Signed-off-by: Jun Piao <piaojun@xxxxxxxxxx>
Reviewed-by: Yiwen Jiang <jiangyiwen@xxxxxxxxxx>
Acked-by: Joseph Qi <jiangqi903@xxxxxxxxx>
Cc: Mark Fasheh <mark@xxxxxxxxxx>
Cc: Joel Becker <jlbec@xxxxxxxxxxxx>
Cc: Junxiao Bi <junxiao.bi@xxxxxxxxxx>
Cc: Changwei Ge <ge.changwei@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 fs/ocfs2/alloc.c       |   43 +++++++++++++++++----------------------
 fs/ocfs2/localalloc.c  |    9 +++-----
 fs/ocfs2/quota_local.c |   15 ++++++-------
 3 files changed, 30 insertions(+), 37 deletions(-)

diff -puN fs/ocfs2/alloc.c~ocfs2-return-erofs-when-filesystem-becomes-read-only fs/ocfs2/alloc.c
--- a/fs/ocfs2/alloc.c~ocfs2-return-erofs-when-filesystem-becomes-read-only
+++ a/fs/ocfs2/alloc.c
@@ -1481,19 +1481,17 @@ static int ocfs2_find_branch_target(stru
 
 	while(le16_to_cpu(el->l_tree_depth) > 1) {
 		if (le16_to_cpu(el->l_next_free_rec) == 0) {
-			ocfs2_error(ocfs2_metadata_cache_get_super(et->et_ci),
-				    "Owner %llu has empty extent list (next_free_rec == 0)\n",
-				    (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci));
-			status = -EIO;
+			status = ocfs2_error(ocfs2_metadata_cache_get_super(et->et_ci),
+				             "Owner %llu has empty extent list (next_free_rec == 0)\n",
+				             (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci));
 			goto bail;
 		}
 		i = le16_to_cpu(el->l_next_free_rec) - 1;
 		blkno = le64_to_cpu(el->l_recs[i].e_blkno);
 		if (!blkno) {
-			ocfs2_error(ocfs2_metadata_cache_get_super(et->et_ci),
-				    "Owner %llu has extent list where extent # %d has no physical block start\n",
-				    (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci), i);
-			status = -EIO;
+			status = ocfs2_error(ocfs2_metadata_cache_get_super(et->et_ci),
+				             "Owner %llu has extent list where extent # %d has no physical block start\n",
+				             (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci), i);
 			goto bail;
 		}
 
@@ -3214,11 +3212,10 @@ rightmost_no_delete:
 			goto rightmost_no_delete;
 
 		if (le16_to_cpu(el->l_next_free_rec) == 0) {
-			ret = -EIO;
-			ocfs2_error(ocfs2_metadata_cache_get_super(et->et_ci),
-				    "Owner %llu has empty extent block at %llu\n",
-				    (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
-				    (unsigned long long)le64_to_cpu(eb->h_blkno));
+			ret = ocfs2_error(ocfs2_metadata_cache_get_super(et->et_ci),
+				          "Owner %llu has empty extent block at %llu\n",
+				          (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
+				          (unsigned long long)le64_to_cpu(eb->h_blkno));
 			goto out;
 		}
 
@@ -4411,12 +4408,11 @@ static int ocfs2_figure_merge_contig_typ
 			    le16_to_cpu(new_el->l_count)) {
 				bh = path_leaf_bh(left_path);
 				eb = (struct ocfs2_extent_block *)bh->b_data;
-				ocfs2_error(sb,
-					    "Extent block #%llu has an invalid l_next_free_rec of %d.  It should have matched the l_count of %d\n",
-					    (unsigned long long)le64_to_cpu(eb->h_blkno),
-					    le16_to_cpu(new_el->l_next_free_rec),
-					    le16_to_cpu(new_el->l_count));
-				status = -EINVAL;
+				status = ocfs2_error(sb,
+					             "Extent block #%llu has an invalid l_next_free_rec of %d.  It should have matched the l_count of %d\n",
+					             (unsigned long long)le64_to_cpu(eb->h_blkno),
+					             le16_to_cpu(new_el->l_next_free_rec),
+					             le16_to_cpu(new_el->l_count));
 				goto free_left_path;
 			}
 			rec = &new_el->l_recs[
@@ -4466,11 +4462,10 @@ static int ocfs2_figure_merge_contig_typ
 			if (le16_to_cpu(new_el->l_next_free_rec) <= 1) {
 				bh = path_leaf_bh(right_path);
 				eb = (struct ocfs2_extent_block *)bh->b_data;
-				ocfs2_error(sb,
-					    "Extent block #%llu has an invalid l_next_free_rec of %d\n",
-					    (unsigned long long)le64_to_cpu(eb->h_blkno),
-					    le16_to_cpu(new_el->l_next_free_rec));
-				status = -EINVAL;
+				status = ocfs2_error(sb,
+					             "Extent block #%llu has an invalid l_next_free_rec of %d\n",
+					             (unsigned long long)le64_to_cpu(eb->h_blkno),
+					             le16_to_cpu(new_el->l_next_free_rec));
 				goto free_right_path;
 			}
 			rec = &new_el->l_recs[1];
diff -puN fs/ocfs2/localalloc.c~ocfs2-return-erofs-when-filesystem-becomes-read-only fs/ocfs2/localalloc.c
--- a/fs/ocfs2/localalloc.c~ocfs2-return-erofs-when-filesystem-becomes-read-only
+++ a/fs/ocfs2/localalloc.c
@@ -663,11 +663,10 @@ int ocfs2_reserve_local_alloc_bits(struc
 #ifdef CONFIG_OCFS2_DEBUG_FS
 	if (le32_to_cpu(alloc->id1.bitmap1.i_used) !=
 	    ocfs2_local_alloc_count_bits(alloc)) {
-		ocfs2_error(osb->sb, "local alloc inode %llu says it has %u used bits, but a count shows %u\n",
-			    (unsigned long long)le64_to_cpu(alloc->i_blkno),
-			    le32_to_cpu(alloc->id1.bitmap1.i_used),
-			    ocfs2_local_alloc_count_bits(alloc));
-		status = -EIO;
+		status = ocfs2_error(osb->sb, "local alloc inode %llu says it has %u used bits, but a count shows %u\n",
+			             (unsigned long long)le64_to_cpu(alloc->i_blkno),
+			             le32_to_cpu(alloc->id1.bitmap1.i_used),
+			             ocfs2_local_alloc_count_bits(alloc));
 		goto bail;
 	}
 #endif
diff -puN fs/ocfs2/quota_local.c~ocfs2-return-erofs-when-filesystem-becomes-read-only fs/ocfs2/quota_local.c
--- a/fs/ocfs2/quota_local.c~ocfs2-return-erofs-when-filesystem-becomes-read-only
+++ a/fs/ocfs2/quota_local.c
@@ -137,14 +137,13 @@ static int ocfs2_read_quota_block(struct
 	int rc = 0;
 	struct buffer_head *tmp = *bh;
 
-	if (i_size_read(inode) >> inode->i_sb->s_blocksize_bits <= v_block) {
-		ocfs2_error(inode->i_sb,
-			    "Quota file %llu is probably corrupted! Requested to read block %Lu but file has size only %Lu\n",
-			    (unsigned long long)OCFS2_I(inode)->ip_blkno,
-			    (unsigned long long)v_block,
-			    (unsigned long long)i_size_read(inode));
-		return -EIO;
-	}
+	if (i_size_read(inode) >> inode->i_sb->s_blocksize_bits <= v_block)
+		return ocfs2_error(inode->i_sb,
+			           "Quota file %llu is probably corrupted! Requested to read block %Lu but file has size only %Lu\n",
+			           (unsigned long long)OCFS2_I(inode)->ip_blkno,
+			           (unsigned long long)v_block,
+			           (unsigned long long)i_size_read(inode));
+
 	rc = ocfs2_read_virt_blocks(inode, v_block, 1, &tmp, 0,
 				    ocfs2_validate_quota_block);
 	if (rc)
_

Patches currently in -mm which might be from piaojun@xxxxxxxxxx are

ocfs2-return-erofs-when-filesystem-becomes-read-only.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux