From 2aa3edcb139c77d606569e79807d1bacf93dba0a Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sun, 20 Jul 2014 07:48:47 -0700 Subject: [PATCH] os/FileStore: fix max object name limit Our max object name is not limited by file name size, but by the length of the name we can stuff in an xattr. That will vary from file system to file system, so just make this 4096. In practice, it should be limited via the global tunable, if it is adjusted at all. Signed-off-by: Sage Weil --- src/os/FileStore.cc | 15 --------------- src/os/FileStore.h | 5 ++++- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index 6b33f97314c7..d0be5714e730 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -1562,21 +1562,6 @@ int FileStore::umount() } -int FileStore::get_max_object_name_length() -{ - lock.Lock(); - int ret = pathconf(basedir.c_str(), _PC_NAME_MAX); - if (ret < 0) { - int err = errno; - lock.Unlock(); - if (err == 0) - return -EDOM; - return -err; - } - lock.Unlock(); - return ret; -} - /// ----------------------------- diff --git a/src/os/FileStore.h b/src/os/FileStore.h index 6e407285073a..bbd587a7c6ed 100644 --- a/src/os/FileStore.h +++ b/src/os/FileStore.h @@ -410,7 +410,10 @@ public: int write_op_seq(int, uint64_t seq); int mount(); int umount(); - int get_max_object_name_length(); + int get_max_object_name_length() { + // not safe for all file systems, btw! use the tunable to limit this. + return 4096; + } int get_max_attr_name_length() { // xattr limit is 128; leave room for our prefixes (user.ceph._), // some margin, and cap at 100 -- 2.47.3