[SRU][MANTIC][PATCH 1/5] Revert "UBUNTU: SAUCE: ceph: BUG if MDS changed truncate_seq with client caps still outstanding"

Dimitri John Ledkov dimitri.ledkov at canonical.com
Fri Oct 27 16:53:43 UTC 2023


BugLink: https://bugs.launchpad.net/bugs/2041613

This reverts commit 8f6163966729043ebfc30b1acd1c031e4d8c9f2b.

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov at canonical.com>
---
 fs/ceph/caps.c  |  5 ++---
 fs/ceph/inode.c | 27 ++++++---------------------
 fs/ceph/super.h |  3 +--
 3 files changed, 9 insertions(+), 26 deletions(-)

diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index dc04022583..b9811b5d6d 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -3658,7 +3658,7 @@ static void handle_cap_grant(struct inode *inode,
 		queue_trunc = ceph_fill_file_size(inode, extra_info->issued,
 					le32_to_cpu(grant->truncate_seq),
 					le64_to_cpu(grant->truncate_size),
-					size, newcaps);
+					size);
 	}
 
 	if (ci->i_auth_cap == cap && (newcaps & CEPH_CAP_ANY_FILE_WR)) {
@@ -4053,8 +4053,7 @@ static bool handle_cap_trunc(struct inode *inode,
 	doutc(cl, "%p %llx.%llx mds%d seq %d to %lld truncate seq %d\n",
 	      inode, ceph_vinop(inode), mds, seq, truncate_size, truncate_seq);
 	queue_trunc = ceph_fill_file_size(inode, issued,
-					  truncate_seq, truncate_size,
-					  size, 0);
+					  truncate_seq, truncate_size, size);
 	return queue_trunc;
 }
 
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 76c5a30c0b..bb8f27d738 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -15,7 +15,6 @@
 #include <linux/sort.h>
 #include <linux/iversion.h>
 #include <linux/fscrypt.h>
-#include <linux/delay.h>
 
 #include "super.h"
 #include "mds_client.h"
@@ -754,8 +753,7 @@ static inline blkcnt_t calc_inode_blocks(u64 size)
  * truncate() increments the corresponding _seq values.)
  */
 int ceph_fill_file_size(struct inode *inode, int issued,
-			u32 truncate_seq, u64 truncate_size,
-			u64 size, int newcaps)
+			u32 truncate_seq, u64 truncate_size, u64 size)
 {
 	struct ceph_client *cl = ceph_inode_to_client(inode);
 	struct ceph_inode_info *ci = ceph_inode(inode);
@@ -784,23 +782,10 @@ int ceph_fill_file_size(struct inode *inode, int issued,
 			ci->i_truncate_seq = truncate_seq;
 
 			/* the MDS should have revoked these caps */
-			if (issued & (CEPH_CAP_FILE_EXCL |
-				      CEPH_CAP_FILE_RD |
-				      CEPH_CAP_FILE_WR |
-				      CEPH_CAP_FILE_LAZYIO)) {
-				pr_err_client(cl,
-					"%p ino %llx.%llx already issued %s, newcaps %s\n",
-					inode, ceph_vinop(inode),
-					ceph_cap_string(issued),
-					ceph_cap_string(newcaps));
-				pr_err_client(cl, " truncate_seq %u -> %u\n",
-					      ci->i_truncate_seq,
-					      truncate_seq);
-				pr_err_client(cl, "  size %lld -> %llu\n",
-					      isize, size);
-				msleep(1000);
-				BUG();
-			}
+			WARN_ON_ONCE(issued & (CEPH_CAP_FILE_EXCL |
+					       CEPH_CAP_FILE_RD |
+					       CEPH_CAP_FILE_WR |
+					       CEPH_CAP_FILE_LAZYIO));
 			/*
 			 * If we hold relevant caps, or in the case where we're
 			 * not the only client referencing this file and we
@@ -1137,7 +1122,7 @@ int ceph_fill_inode(struct inode *inode, struct page *locked_page,
 		queue_trunc = ceph_fill_file_size(inode, issued,
 					le32_to_cpu(info->truncate_seq),
 					le64_to_cpu(info->truncate_size),
-					size, info_caps);
+					size);
 		/* only update max_size on auth cap */
 		if ((info->cap.flags & CEPH_CAP_FLAG_AUTH) &&
 		    ci->i_max_size != le64_to_cpu(info->max_size)) {
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index a76a504d13..7fb990c212 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -1041,8 +1041,7 @@ extern struct inode *ceph_get_inode(struct super_block *sb,
 				    struct inode *newino);
 extern struct inode *ceph_get_snapdir(struct inode *parent);
 extern int ceph_fill_file_size(struct inode *inode, int issued,
-			       u32 truncate_seq, u64 truncate_size,
-			       u64 size, int newcaps);
+			       u32 truncate_seq, u64 truncate_size, u64 size);
 extern void ceph_fill_file_time(struct inode *inode, int issued,
 				u64 time_warp_seq, struct timespec64 *ctime,
 				struct timespec64 *mtime,
-- 
2.34.1




More information about the kernel-team mailing list