From dd902598a7f392f8ce76d8286c1da8fbb01b337c Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 17 Jul 2008 11:08:26 -0700 Subject: [PATCH] mds: fix shared write vs max_size adjustment --- src/TODO | 2 -- src/mds/Locker.cc | 10 +++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/TODO b/src/TODO index fa7147da35bb6..5b5d0750288b7 100644 --- a/src/TODO +++ b/src/TODO @@ -79,8 +79,6 @@ mon - osdmon needs to lower-bound old osdmap versions it keeps around? mds -- fix shared write vs max_size - - proper handling of cache expire messages during rejoin phase? -> i think cache expires are fine; the rejoin_ack handler just has to behave if rejoining items go missing - try_remove_unlinked_dn thing diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index 5e9735e74d8fa..7c1dac849235e 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -993,7 +993,7 @@ void Locker::handle_client_file_caps(MClientFileCaps *m) << ", has " << cap_string(has) << " on " << *in << dendl; - _do_cap_update(in, had, wanted, follows, m); + _do_cap_update(in, had, in->get_caps_wanted() | wanted, follows, m); if (m->get_seq() < cap->get_last_open()) { /* client may be trying to release caps (i.e. inode closed, etc.) @@ -1031,7 +1031,7 @@ void Locker::handle_client_file_caps(MClientFileCaps *m) } -void Locker::_do_cap_update(CInode *in, int had, int wanted, snapid_t follows, MClientFileCaps *m) +void Locker::_do_cap_update(CInode *in, int had, int all_wanted, snapid_t follows, MClientFileCaps *m) { dout(10) << "_do_cap_update had " << cap_string(had) << " on " << *in << dendl; @@ -1066,18 +1066,18 @@ void Locker::_do_cap_update(CInode *in, int had, int wanted, snapid_t follows, M uint64_t new_max = latest->max_size; if (in->is_auth()) { - if (latest->max_size && (wanted & (CEPH_CAP_WR|CEPH_CAP_WRBUFFER)) == 0) { + if (latest->max_size && (all_wanted & (CEPH_CAP_WR|CEPH_CAP_WRBUFFER)) == 0) { change_max = true; new_max = 0; } - else if ((wanted & (CEPH_CAP_WR|CEPH_CAP_WRBUFFER|CEPH_CAP_WREXTEND)) && + else if ((all_wanted & (CEPH_CAP_WR|CEPH_CAP_WRBUFFER|CEPH_CAP_WREXTEND)) && (size << 1) >= latest->max_size) { dout(10) << "wr caps wanted, and size " << size << " *2 >= max " << latest->max_size << ", increasing" << dendl; change_max = true; new_max = latest->max_size ? (latest->max_size << 1):in->get_layout_size_increment(); } - if ((wanted & (CEPH_CAP_WR|CEPH_CAP_WRBUFFER|CEPH_CAP_WREXTEND)) && + if ((all_wanted & (CEPH_CAP_WR|CEPH_CAP_WRBUFFER|CEPH_CAP_WREXTEND)) && m->get_max_size() > new_max) { dout(10) << "client requests file_max " << m->get_max_size() << " > max " << latest->max_size << dendl; -- 2.39.5