Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kraken: rgw: rgw_file: fix marker computation #13871

Merged
merged 27 commits into from Jul 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
70ebe96
rgw_file: invalid use of RGWFileHandle::FLAG_EXACT_MATCH
mattbenjamin Feb 19, 2017
2e27aa9
rgw_file: allow setattr on placeholder directories
mattbenjamin Feb 19, 2017
c613ee7
rgw_file: rgw_readdir can't list multi-segment dirs
mattbenjamin Feb 20, 2017
50955a5
rgw_file: add timed namespace invalidation
mattbenjamin Jan 19, 2017
7faa917
rgw_file: fix marker computation
mattbenjamin Feb 20, 2017
b350b61
rgw_file: implement reliable has-children check (unlink dir)
mattbenjamin Mar 14, 2017
b04d051
rgw_file: rgw_readdir: return dot-dirs only when *offset is 0
mattbenjamin Mar 15, 2017
34553f9
rgw_file: remove unused rgw_key variable
mattbenjamin Mar 15, 2017
e03a5cb
rgw_file: fix missing unlock in unlink
Mar 31, 2017
4af9f6f
rgw_file: avoid stranding invalid-name bucket handles in fhcache
mattbenjamin Feb 22, 2017
1553877
rgw_file: interned RGWFileHandle objects need parent refs
mattbenjamin Dec 31, 2016
a446c72
rgw_file: add pretty-print for RGWFileHandle
mattbenjamin Feb 10, 2017
9994110
rgw_file: add refcount dout traces at debuglevel 17
mattbenjamin Feb 11, 2017
29fe4cf
rgw_file: refcnt bugfixes
mattbenjamin Feb 12, 2017
fa20800
rgw_file: use fh_hook::is_linked() to check residence
mattbenjamin Feb 28, 2017
64cce34
rgw_file: return of RGWFileHandle::FLAG_EXACT_MATCH
mattbenjamin Feb 23, 2017
2b9a77e
rgw_file: introduce rgw_lookup type hints
mattbenjamin Apr 5, 2017
349de8a
rgw_file: fix RGWLibFS::setattr for directory objects
mattbenjamin Feb 3, 2017
6e0b260
rgw_file: ensure valid_s3_object_name for directories, too
mattbenjamin Feb 23, 2017
f97ab40
rgw_file: rgw_lookup: don't ref for "/" or ".."
mattbenjamin Feb 22, 2017
e5c78f8
rgw_file: fix double unref on rgw_fh for rename
Mar 15, 2017
59a965a
rgw_file: fix reversed return value of getattr
Mar 8, 2017
78e2516
rgw_file: posix style atime,ctime,mtime
Mar 2, 2017
ac1dd8d
rgw_file: RGWFileHandle dtor must also cond-unlink from FHCache
mattbenjamin Mar 1, 2017
247f897
rgw_file: chunked readdir
mattbenjamin Apr 11, 2017
ea3aec3
rgw_file: don't expire directories being read
mattbenjamin Apr 11, 2017
b7503d3
rgw_file: fix readdir after dirent-change
mattbenjamin Apr 14, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/common/cohort_lru.h
Expand Up @@ -143,6 +143,12 @@ namespace cohort {
continue;
// XXXX if object at LRU has refcnt==1, take it
Object* o = &(lane.q.back());
#if 0 /* XXX save for refactor */
std::cout << __func__
<< " " << o
<< " refcnt: " << o->lru_refcnt
<< std::endl;
#endif
if (can_reclaim(o)) {
++(o->lru_refcnt);
o->lru_flags |= FLAG_EVICTING;
Expand Down Expand Up @@ -213,6 +219,18 @@ namespace cohort {
delete o;
}
lane.lock.unlock();
} else if (unlikely(refcnt == SENTINEL_REFCNT)) {
Lane& lane = lane_of(o);
lane.lock.lock();
refcnt = o->lru_refcnt.load();
if (likely(refcnt == SENTINEL_REFCNT)) {
/* move to LRU */
Object::Queue::iterator it =
Object::Queue::s_iterator_to(*o);
lane.q.erase(it);
lane.q.push_back(*o);
}
lane.lock.unlock();
}
} /* unref */

Expand Down
3 changes: 3 additions & 0 deletions src/common/config_opts.h
Expand Up @@ -1465,6 +1465,9 @@ OPTION(rgw_nfs_lru_lanes, OPT_INT, 5)
OPTION(rgw_nfs_lru_lane_hiwat, OPT_INT, 911)
OPTION(rgw_nfs_fhcache_partitions, OPT_INT, 3)
OPTION(rgw_nfs_fhcache_size, OPT_INT, 2017) /* 3*2017=6051 */
OPTION(rgw_nfs_namespace_expire_secs, OPT_INT, 300) /* namespace invalidate
* timer */
OPTION(rgw_nfs_max_gc, OPT_INT, 300) /* max gc events per cycle */
OPTION(rgw_nfs_write_completion_interval_s, OPT_INT, 10) /* stateless (V3)
* commit
* delay */
Expand Down
24 changes: 21 additions & 3 deletions src/include/rados/rgw_file.h
Expand Up @@ -27,7 +27,7 @@ extern "C" {

#define LIBRGW_FILE_VER_MAJOR 1
#define LIBRGW_FILE_VER_MINOR 1
#define LIBRGW_FILE_VER_EXTRA 0
#define LIBRGW_FILE_VER_EXTRA 3

#define LIBRGW_FILE_VERSION(maj, min, extra) ((maj << 16) + (min << 8) + extra)
#define LIBRGW_FILE_VERSION_CODE LIBRGW_FILE_VERSION(LIBRGW_FILE_VER_MAJOR, LIBRGW_FILE_VER_MINOR, LIBRGW_FILE_VER_EXTRA)
Expand All @@ -36,7 +36,8 @@ extern "C" {
* object types
*/
enum rgw_fh_type {
RGW_FS_TYPE_FILE = 0,
RGW_FS_TYPE_NIL = 0,
RGW_FS_TYPE_FILE,
RGW_FS_TYPE_DIRECTORY,
};

Expand Down Expand Up @@ -91,6 +92,12 @@ void rgwfile_version(int *major, int *minor, int *extra);
*/
#define RGW_LOOKUP_FLAG_NONE 0x0000
#define RGW_LOOKUP_FLAG_CREATE 0x0001
#define RGW_LOOKUP_FLAG_RCB 0x0002 /* readdir callback hint */
#define RGW_LOOKUP_FLAG_DIR 0x0004
#define RGW_LOOKUP_FLAG_FILE 0x0008

#define RGW_LOOKUP_TYPE_FLAGS \
(RGW_LOOKUP_FLAG_DIR|RGW_LOOKUP_FLAG_FILE)

int rgw_lookup(struct rgw_fs *rgw_fs,
struct rgw_file_handle *parent_fh, const char *path,
Expand Down Expand Up @@ -119,6 +126,16 @@ int rgw_mount(librgw_t rgw, const char *uid, const char *key,
const char *secret, struct rgw_fs **rgw_fs,
uint32_t flags);

/*
register invalidate callbacks
*/
#define RGW_REG_INVALIDATE_FLAG_NONE 0x0000

typedef void (*rgw_fh_callback_t)(void *handle, struct rgw_fh_hk fh_hk);

int rgw_register_invalidate(struct rgw_fs *rgw_fs, rgw_fh_callback_t cb,
void *arg, uint32_t flags);

/*
detach rgw namespace
*/
Expand Down Expand Up @@ -189,7 +206,8 @@ int rgw_unlink(struct rgw_fs *rgw_fs,
/*
read directory content
*/
typedef bool (*rgw_readdir_cb)(const char *name, void *arg, uint64_t offset);
typedef bool (*rgw_readdir_cb)(const char *name, void *arg, uint64_t offset,
uint32_t flags);

#define RGW_READDIR_FLAG_NONE 0x0000
#define RGW_READDIR_FLAG_DOTDOT 0x0001 /* send dot names */
Expand Down
13 changes: 12 additions & 1 deletion src/rgw/librgw.cc
Expand Up @@ -13,6 +13,7 @@
*/
#include <sys/types.h>
#include <string.h>
#include <chrono>

#include "include/types.h"
#include "include/rados/librgw.h"
Expand Down Expand Up @@ -80,6 +81,8 @@ namespace rgw {
m_tp.drain(&req_wq);
}

#define MIN_EXPIRE_S 120

void RGWLibProcess::run()
{
/* write completion interval */
Expand All @@ -92,6 +95,14 @@ namespace rgw {
/* gc loop */
while (! shutdown) {
lsubdout(cct, rgw, 5) << "RGWLibProcess GC" << dendl;

/* dirent invalidate timeout--basically, the upper-bound on
* inconsistency with the S3 namespace */
auto expire_s = cct->_conf->rgw_nfs_namespace_expire_secs;

/* delay between gc cycles */
auto delay_s = std::max(1, std::min(MIN_EXPIRE_S, expire_s/2));

unique_lock uniq(mtx);
restart:
int cur_gen = gen;
Expand All @@ -106,7 +117,7 @@ namespace rgw {
goto restart; /* invalidated */
}
uniq.unlock();
std::this_thread::sleep_for(std::chrono::seconds(120));
std::this_thread::sleep_for(std::chrono::seconds(delay_s));
}
}

Expand Down