ceph: fix xattr cap writeback
We should include the xattr metadata blob in the cap update message any time we are flushing dirty state, NOT just when we are also dropping the cap. This fixes async xattr writeback. Also, clean up the code slightly to avoid duplicating the bit test. Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
parent
f3c60c5918
commit
082afec92d
@ -1082,6 +1082,7 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap,
|
|||||||
gid_t gid;
|
gid_t gid;
|
||||||
struct ceph_mds_session *session;
|
struct ceph_mds_session *session;
|
||||||
u64 xattr_version = 0;
|
u64 xattr_version = 0;
|
||||||
|
struct ceph_buffer *xattr_blob = NULL;
|
||||||
int delayed = 0;
|
int delayed = 0;
|
||||||
u64 flush_tid = 0;
|
u64 flush_tid = 0;
|
||||||
int i;
|
int i;
|
||||||
@ -1160,9 +1161,10 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap,
|
|||||||
gid = inode->i_gid;
|
gid = inode->i_gid;
|
||||||
mode = inode->i_mode;
|
mode = inode->i_mode;
|
||||||
|
|
||||||
if (dropping & CEPH_CAP_XATTR_EXCL) {
|
if (flushing & CEPH_CAP_XATTR_EXCL) {
|
||||||
__ceph_build_xattrs_blob(ci);
|
__ceph_build_xattrs_blob(ci);
|
||||||
xattr_version = ci->i_xattrs.version + 1;
|
xattr_blob = ci->i_xattrs.blob;
|
||||||
|
xattr_version = ci->i_xattrs.version;
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_unlock(&inode->i_lock);
|
spin_unlock(&inode->i_lock);
|
||||||
@ -1170,9 +1172,7 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap,
|
|||||||
ret = send_cap_msg(session, ceph_vino(inode).ino, cap_id,
|
ret = send_cap_msg(session, ceph_vino(inode).ino, cap_id,
|
||||||
op, keep, want, flushing, seq, flush_tid, issue_seq, mseq,
|
op, keep, want, flushing, seq, flush_tid, issue_seq, mseq,
|
||||||
size, max_size, &mtime, &atime, time_warp_seq,
|
size, max_size, &mtime, &atime, time_warp_seq,
|
||||||
uid, gid, mode,
|
uid, gid, mode, xattr_version, xattr_blob,
|
||||||
xattr_version,
|
|
||||||
(flushing & CEPH_CAP_XATTR_EXCL) ? ci->i_xattrs.blob : NULL,
|
|
||||||
follows);
|
follows);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dout("error sending cap msg, must requeue %p\n", inode);
|
dout("error sending cap msg, must requeue %p\n", inode);
|
||||||
|
Loading…
Reference in New Issue
Block a user