1 #include <linux/ceph/ceph_debug.h>
4 #include "mds_client.h"
6 #include <linux/ceph/decode.h>
8 #include <linux/xattr.h>
9 #include <linux/slab.h>
11 #define XATTR_CEPH_PREFIX "ceph."
12 #define XATTR_CEPH_PREFIX_LEN (sizeof (XATTR_CEPH_PREFIX) - 1)
14 static bool ceph_is_valid_xattr(const char *name)
16 return !strncmp(name, XATTR_CEPH_PREFIX, XATTR_CEPH_PREFIX_LEN) ||
17 !strncmp(name, XATTR_SECURITY_PREFIX,
18 XATTR_SECURITY_PREFIX_LEN) ||
19 !strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) ||
20 !strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN);
24 * These define virtual xattrs exposing the recursive directory
25 * statistics and layout metadata.
29 size_t name_size; /* strlen(name) + 1 (for '\0') */
30 size_t (*getxattr_cb)(struct ceph_inode_info *ci, char *val,
37 static size_t ceph_vxattrcb_dir_entries(struct ceph_inode_info *ci, char *val,
40 return snprintf(val, size, "%lld", ci->i_files + ci->i_subdirs);
43 static size_t ceph_vxattrcb_dir_files(struct ceph_inode_info *ci, char *val,
46 return snprintf(val, size, "%lld", ci->i_files);
49 static size_t ceph_vxattrcb_dir_subdirs(struct ceph_inode_info *ci, char *val,
52 return snprintf(val, size, "%lld", ci->i_subdirs);
55 static size_t ceph_vxattrcb_dir_rentries(struct ceph_inode_info *ci, char *val,
58 return snprintf(val, size, "%lld", ci->i_rfiles + ci->i_rsubdirs);
61 static size_t ceph_vxattrcb_dir_rfiles(struct ceph_inode_info *ci, char *val,
64 return snprintf(val, size, "%lld", ci->i_rfiles);
67 static size_t ceph_vxattrcb_dir_rsubdirs(struct ceph_inode_info *ci, char *val,
70 return snprintf(val, size, "%lld", ci->i_rsubdirs);
73 static size_t ceph_vxattrcb_dir_rbytes(struct ceph_inode_info *ci, char *val,
76 return snprintf(val, size, "%lld", ci->i_rbytes);
79 static size_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val,
82 return snprintf(val, size, "%ld.09%ld", (long)ci->i_rctime.tv_sec,
83 (long)ci->i_rctime.tv_nsec);
86 #define CEPH_XATTR_NAME(_type, _name) XATTR_CEPH_PREFIX #_type "." #_name
88 #define XATTR_NAME_CEPH(_type, _name) \
90 .name = CEPH_XATTR_NAME(_type, _name), \
91 .name_size = sizeof (CEPH_XATTR_NAME(_type, _name)), \
92 .getxattr_cb = ceph_vxattrcb_ ## _type ## _ ## _name, \
96 static struct ceph_vxattr ceph_dir_vxattrs[] = {
97 XATTR_NAME_CEPH(dir, entries),
98 XATTR_NAME_CEPH(dir, files),
99 XATTR_NAME_CEPH(dir, subdirs),
100 XATTR_NAME_CEPH(dir, rentries),
101 XATTR_NAME_CEPH(dir, rfiles),
102 XATTR_NAME_CEPH(dir, rsubdirs),
103 XATTR_NAME_CEPH(dir, rbytes),
104 XATTR_NAME_CEPH(dir, rctime),
105 { 0 } /* Required table terminator */
107 static size_t ceph_dir_vxattrs_name_size; /* total size of all names */
111 static size_t ceph_vxattrcb_file_layout(struct ceph_inode_info *ci, char *val,
116 ret = snprintf(val, size,
117 "chunk_bytes=%lld\nstripe_count=%lld\nobject_size=%lld\n",
118 (unsigned long long)ceph_file_layout_su(ci->i_layout),
119 (unsigned long long)ceph_file_layout_stripe_count(ci->i_layout),
120 (unsigned long long)ceph_file_layout_object_size(ci->i_layout));
124 static struct ceph_vxattr ceph_file_vxattrs[] = {
125 XATTR_NAME_CEPH(file, layout),
126 { 0 } /* Required table terminator */
128 static size_t ceph_file_vxattrs_name_size; /* total size of all names */
130 static struct ceph_vxattr *ceph_inode_vxattrs(struct inode *inode)
132 if (S_ISDIR(inode->i_mode))
133 return ceph_dir_vxattrs;
134 else if (S_ISREG(inode->i_mode))
135 return ceph_file_vxattrs;
139 static size_t ceph_vxattrs_name_size(struct ceph_vxattr *vxattrs)
141 if (vxattrs == ceph_dir_vxattrs)
142 return ceph_dir_vxattrs_name_size;
143 if (vxattrs == ceph_file_vxattrs)
144 return ceph_file_vxattrs_name_size;
151 * Compute the aggregate size (including terminating '\0') of all
152 * virtual extended attribute names in the given vxattr table.
154 static size_t __init vxattrs_name_size(struct ceph_vxattr *vxattrs)
156 struct ceph_vxattr *vxattr;
159 for (vxattr = vxattrs; vxattr->name; vxattr++)
160 size += vxattr->name_size;
165 /* Routines called at initialization and exit time */
167 void __init ceph_xattr_init(void)
169 ceph_dir_vxattrs_name_size = vxattrs_name_size(ceph_dir_vxattrs);
170 ceph_file_vxattrs_name_size = vxattrs_name_size(ceph_file_vxattrs);
173 void ceph_xattr_exit(void)
175 ceph_dir_vxattrs_name_size = 0;
176 ceph_file_vxattrs_name_size = 0;
179 static struct ceph_vxattr *ceph_match_vxattr(struct inode *inode,
182 struct ceph_vxattr *vxattr = ceph_inode_vxattrs(inode);
185 while (vxattr->name) {
186 if (!strcmp(vxattr->name, name))
195 static int __set_xattr(struct ceph_inode_info *ci,
196 const char *name, int name_len,
197 const char *val, int val_len,
199 int should_free_name, int should_free_val,
200 struct ceph_inode_xattr **newxattr)
203 struct rb_node *parent = NULL;
204 struct ceph_inode_xattr *xattr = NULL;
208 p = &ci->i_xattrs.index.rb_node;
211 xattr = rb_entry(parent, struct ceph_inode_xattr, node);
212 c = strncmp(name, xattr->name, min(name_len, xattr->name_len));
218 if (name_len == xattr->name_len)
220 else if (name_len < xattr->name_len)
232 xattr->name_len = name_len;
233 xattr->should_free_name = should_free_name;
235 ci->i_xattrs.count++;
236 dout("__set_xattr count=%d\n", ci->i_xattrs.count);
240 if (xattr->should_free_val)
241 kfree((void *)xattr->val);
243 if (should_free_name) {
247 ci->i_xattrs.names_size -= xattr->name_len;
248 ci->i_xattrs.vals_size -= xattr->val_len;
250 ci->i_xattrs.names_size += name_len;
251 ci->i_xattrs.vals_size += val_len;
257 xattr->val_len = val_len;
258 xattr->dirty = dirty;
259 xattr->should_free_val = (val && should_free_val);
262 rb_link_node(&xattr->node, parent, p);
263 rb_insert_color(&xattr->node, &ci->i_xattrs.index);
264 dout("__set_xattr_val p=%p\n", p);
267 dout("__set_xattr_val added %llx.%llx xattr %p %s=%.*s\n",
268 ceph_vinop(&ci->vfs_inode), xattr, name, val_len, val);
273 static struct ceph_inode_xattr *__get_xattr(struct ceph_inode_info *ci,
277 struct rb_node *parent = NULL;
278 struct ceph_inode_xattr *xattr = NULL;
279 int name_len = strlen(name);
282 p = &ci->i_xattrs.index.rb_node;
285 xattr = rb_entry(parent, struct ceph_inode_xattr, node);
286 c = strncmp(name, xattr->name, xattr->name_len);
287 if (c == 0 && name_len > xattr->name_len)
294 dout("__get_xattr %s: found %.*s\n", name,
295 xattr->val_len, xattr->val);
300 dout("__get_xattr %s: not found\n", name);
305 static void __free_xattr(struct ceph_inode_xattr *xattr)
309 if (xattr->should_free_name)
310 kfree((void *)xattr->name);
311 if (xattr->should_free_val)
312 kfree((void *)xattr->val);
317 static int __remove_xattr(struct ceph_inode_info *ci,
318 struct ceph_inode_xattr *xattr)
323 rb_erase(&xattr->node, &ci->i_xattrs.index);
325 if (xattr->should_free_name)
326 kfree((void *)xattr->name);
327 if (xattr->should_free_val)
328 kfree((void *)xattr->val);
330 ci->i_xattrs.names_size -= xattr->name_len;
331 ci->i_xattrs.vals_size -= xattr->val_len;
332 ci->i_xattrs.count--;
338 static int __remove_xattr_by_name(struct ceph_inode_info *ci,
342 struct ceph_inode_xattr *xattr;
345 p = &ci->i_xattrs.index.rb_node;
346 xattr = __get_xattr(ci, name);
347 err = __remove_xattr(ci, xattr);
351 static char *__copy_xattr_names(struct ceph_inode_info *ci,
355 struct ceph_inode_xattr *xattr = NULL;
357 p = rb_first(&ci->i_xattrs.index);
358 dout("__copy_xattr_names count=%d\n", ci->i_xattrs.count);
361 xattr = rb_entry(p, struct ceph_inode_xattr, node);
362 memcpy(dest, xattr->name, xattr->name_len);
363 dest[xattr->name_len] = '\0';
365 dout("dest=%s %p (%s) (%d/%d)\n", dest, xattr, xattr->name,
366 xattr->name_len, ci->i_xattrs.names_size);
368 dest += xattr->name_len + 1;
375 void __ceph_destroy_xattrs(struct ceph_inode_info *ci)
377 struct rb_node *p, *tmp;
378 struct ceph_inode_xattr *xattr = NULL;
380 p = rb_first(&ci->i_xattrs.index);
382 dout("__ceph_destroy_xattrs p=%p\n", p);
385 xattr = rb_entry(p, struct ceph_inode_xattr, node);
388 dout("__ceph_destroy_xattrs next p=%p (%.*s)\n", p,
389 xattr->name_len, xattr->name);
390 rb_erase(tmp, &ci->i_xattrs.index);
395 ci->i_xattrs.names_size = 0;
396 ci->i_xattrs.vals_size = 0;
397 ci->i_xattrs.index_version = 0;
398 ci->i_xattrs.count = 0;
399 ci->i_xattrs.index = RB_ROOT;
402 static int __build_xattrs(struct inode *inode)
403 __releases(ci->i_ceph_lock)
404 __acquires(ci->i_ceph_lock)
410 const char *name, *val;
411 struct ceph_inode_info *ci = ceph_inode(inode);
413 struct ceph_inode_xattr **xattrs = NULL;
417 dout("__build_xattrs() len=%d\n",
418 ci->i_xattrs.blob ? (int)ci->i_xattrs.blob->vec.iov_len : 0);
420 if (ci->i_xattrs.index_version >= ci->i_xattrs.version)
421 return 0; /* already built */
423 __ceph_destroy_xattrs(ci);
426 /* updated internal xattr rb tree */
427 if (ci->i_xattrs.blob && ci->i_xattrs.blob->vec.iov_len > 4) {
428 p = ci->i_xattrs.blob->vec.iov_base;
429 end = p + ci->i_xattrs.blob->vec.iov_len;
430 ceph_decode_32_safe(&p, end, numattr, bad);
431 xattr_version = ci->i_xattrs.version;
432 spin_unlock(&ci->i_ceph_lock);
434 xattrs = kcalloc(numattr, sizeof(struct ceph_xattr *),
439 memset(xattrs, 0, numattr*sizeof(struct ceph_xattr *));
440 for (i = 0; i < numattr; i++) {
441 xattrs[i] = kmalloc(sizeof(struct ceph_inode_xattr),
447 spin_lock(&ci->i_ceph_lock);
448 if (ci->i_xattrs.version != xattr_version) {
449 /* lost a race, retry */
450 for (i = 0; i < numattr; i++)
458 ceph_decode_32_safe(&p, end, len, bad);
462 ceph_decode_32_safe(&p, end, len, bad);
466 err = __set_xattr(ci, name, namelen, val, len,
467 0, 0, 0, &xattrs[numattr]);
474 ci->i_xattrs.index_version = ci->i_xattrs.version;
475 ci->i_xattrs.dirty = false;
479 spin_lock(&ci->i_ceph_lock);
482 for (i = 0; i < numattr; i++)
486 ci->i_xattrs.names_size = 0;
490 static int __get_required_blob_size(struct ceph_inode_info *ci, int name_size,
494 * 4 bytes for the length, and additional 4 bytes per each xattr name,
495 * 4 bytes per each value
497 int size = 4 + ci->i_xattrs.count*(4 + 4) +
498 ci->i_xattrs.names_size +
499 ci->i_xattrs.vals_size;
500 dout("__get_required_blob_size c=%d names.size=%d vals.size=%d\n",
501 ci->i_xattrs.count, ci->i_xattrs.names_size,
502 ci->i_xattrs.vals_size);
505 size += 4 + 4 + name_size + val_size;
511 * If there are dirty xattrs, reencode xattrs into the prealloc_blob
512 * and swap into place.
514 void __ceph_build_xattrs_blob(struct ceph_inode_info *ci)
517 struct ceph_inode_xattr *xattr = NULL;
520 dout("__build_xattrs_blob %p\n", &ci->vfs_inode);
521 if (ci->i_xattrs.dirty) {
522 int need = __get_required_blob_size(ci, 0, 0);
524 BUG_ON(need > ci->i_xattrs.prealloc_blob->alloc_len);
526 p = rb_first(&ci->i_xattrs.index);
527 dest = ci->i_xattrs.prealloc_blob->vec.iov_base;
529 ceph_encode_32(&dest, ci->i_xattrs.count);
531 xattr = rb_entry(p, struct ceph_inode_xattr, node);
533 ceph_encode_32(&dest, xattr->name_len);
534 memcpy(dest, xattr->name, xattr->name_len);
535 dest += xattr->name_len;
536 ceph_encode_32(&dest, xattr->val_len);
537 memcpy(dest, xattr->val, xattr->val_len);
538 dest += xattr->val_len;
543 /* adjust buffer len; it may be larger than we need */
544 ci->i_xattrs.prealloc_blob->vec.iov_len =
545 dest - ci->i_xattrs.prealloc_blob->vec.iov_base;
547 if (ci->i_xattrs.blob)
548 ceph_buffer_put(ci->i_xattrs.blob);
549 ci->i_xattrs.blob = ci->i_xattrs.prealloc_blob;
550 ci->i_xattrs.prealloc_blob = NULL;
551 ci->i_xattrs.dirty = false;
552 ci->i_xattrs.version++;
556 ssize_t ceph_getxattr(struct dentry *dentry, const char *name, void *value,
559 struct inode *inode = dentry->d_inode;
560 struct ceph_inode_info *ci = ceph_inode(inode);
562 struct ceph_inode_xattr *xattr;
563 struct ceph_vxattr *vxattr = NULL;
565 if (!ceph_is_valid_xattr(name))
568 /* let's see if a virtual xattr was requested */
569 vxattr = ceph_match_vxattr(inode, name);
571 spin_lock(&ci->i_ceph_lock);
572 dout("getxattr %p ver=%lld index_ver=%lld\n", inode,
573 ci->i_xattrs.version, ci->i_xattrs.index_version);
575 if (__ceph_caps_issued_mask(ci, CEPH_CAP_XATTR_SHARED, 1) &&
576 (ci->i_xattrs.index_version >= ci->i_xattrs.version)) {
579 spin_unlock(&ci->i_ceph_lock);
580 /* get xattrs from mds (if we don't already have them) */
581 err = ceph_do_getattr(inode, CEPH_STAT_CAP_XATTR);
586 spin_lock(&ci->i_ceph_lock);
588 if (vxattr && vxattr->readonly) {
589 err = vxattr->getxattr_cb(ci, value, size);
593 err = __build_xattrs(inode);
598 err = -ENODATA; /* == ENOATTR */
599 xattr = __get_xattr(ci, name);
602 err = vxattr->getxattr_cb(ci, value, size);
607 if (size && size < xattr->val_len)
610 err = xattr->val_len;
614 memcpy(value, xattr->val, xattr->val_len);
617 spin_unlock(&ci->i_ceph_lock);
621 ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size)
623 struct inode *inode = dentry->d_inode;
624 struct ceph_inode_info *ci = ceph_inode(inode);
625 struct ceph_vxattr *vxattrs = ceph_inode_vxattrs(inode);
632 spin_lock(&ci->i_ceph_lock);
633 dout("listxattr %p ver=%lld index_ver=%lld\n", inode,
634 ci->i_xattrs.version, ci->i_xattrs.index_version);
636 if (__ceph_caps_issued_mask(ci, CEPH_CAP_XATTR_SHARED, 1) &&
637 (ci->i_xattrs.index_version >= ci->i_xattrs.version)) {
640 spin_unlock(&ci->i_ceph_lock);
641 err = ceph_do_getattr(inode, CEPH_STAT_CAP_XATTR);
646 spin_lock(&ci->i_ceph_lock);
648 err = __build_xattrs(inode);
654 * Start with virtual dir xattr names (if any) (including
655 * terminating '\0' characters for each).
657 vir_namelen = ceph_vxattrs_name_size(vxattrs);
659 /* adding 1 byte per each variable due to the null termination */
660 namelen = vir_namelen + ci->i_xattrs.names_size + ci->i_xattrs.count;
662 if (size && namelen > size)
669 names = __copy_xattr_names(ci, names);
671 /* virtual xattr names, too */
673 for (i = 0; vxattrs[i].name; i++) {
674 len = sprintf(names, "%s", vxattrs[i].name);
679 spin_unlock(&ci->i_ceph_lock);
683 static int ceph_sync_setxattr(struct dentry *dentry, const char *name,
684 const char *value, size_t size, int flags)
686 struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb);
687 struct inode *inode = dentry->d_inode;
688 struct ceph_inode_info *ci = ceph_inode(inode);
689 struct inode *parent_inode;
690 struct ceph_mds_request *req;
691 struct ceph_mds_client *mdsc = fsc->mdsc;
694 struct page **pages = NULL;
697 /* copy value into some pages */
698 nr_pages = calc_pages_for(0, size);
700 pages = kmalloc(sizeof(pages[0])*nr_pages, GFP_NOFS);
704 for (i = 0; i < nr_pages; i++) {
705 pages[i] = __page_cache_alloc(GFP_NOFS);
710 kaddr = kmap(pages[i]);
711 memcpy(kaddr, value + i*PAGE_CACHE_SIZE,
712 min(PAGE_CACHE_SIZE, size-i*PAGE_CACHE_SIZE));
716 dout("setxattr value=%.*s\n", (int)size, value);
719 req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_SETXATTR,
725 req->r_inode = inode;
727 req->r_inode_drop = CEPH_CAP_XATTR_SHARED;
729 req->r_args.setxattr.flags = cpu_to_le32(flags);
730 req->r_path2 = kstrdup(name, GFP_NOFS);
732 req->r_pages = pages;
733 req->r_num_pages = nr_pages;
734 req->r_data_len = size;
736 dout("xattr.ver (before): %lld\n", ci->i_xattrs.version);
737 parent_inode = ceph_get_dentry_parent_inode(dentry);
738 err = ceph_mdsc_do_request(mdsc, parent_inode, req);
740 ceph_mdsc_put_request(req);
741 dout("xattr.ver (after): %lld\n", ci->i_xattrs.version);
745 for (i = 0; i < nr_pages; i++)
746 __free_page(pages[i]);
752 int ceph_setxattr(struct dentry *dentry, const char *name,
753 const void *value, size_t size, int flags)
755 struct inode *inode = dentry->d_inode;
756 struct ceph_vxattr *vxattr;
757 struct ceph_inode_info *ci = ceph_inode(inode);
761 int name_len = strlen(name);
763 char *newname = NULL;
765 struct ceph_inode_xattr *xattr = NULL;
766 int required_blob_size;
768 if (ceph_snap(inode) != CEPH_NOSNAP)
771 if (!ceph_is_valid_xattr(name))
774 vxattr = ceph_match_vxattr(inode, name);
775 if (vxattr && vxattr->readonly)
778 /* preallocate memory for xattr name, value, index node */
780 newname = kmemdup(name, name_len + 1, GFP_NOFS);
785 newval = kmemdup(value, val_len, GFP_NOFS);
790 xattr = kmalloc(sizeof(struct ceph_inode_xattr), GFP_NOFS);
794 spin_lock(&ci->i_ceph_lock);
796 issued = __ceph_caps_issued(ci, NULL);
797 dout("setxattr %p issued %s\n", inode, ceph_cap_string(issued));
798 if (!(issued & CEPH_CAP_XATTR_EXCL))
800 __build_xattrs(inode);
802 required_blob_size = __get_required_blob_size(ci, name_len, val_len);
804 if (!ci->i_xattrs.prealloc_blob ||
805 required_blob_size > ci->i_xattrs.prealloc_blob->alloc_len) {
806 struct ceph_buffer *blob;
808 spin_unlock(&ci->i_ceph_lock);
809 dout(" preaallocating new blob size=%d\n", required_blob_size);
810 blob = ceph_buffer_new(required_blob_size, GFP_NOFS);
813 spin_lock(&ci->i_ceph_lock);
814 if (ci->i_xattrs.prealloc_blob)
815 ceph_buffer_put(ci->i_xattrs.prealloc_blob);
816 ci->i_xattrs.prealloc_blob = blob;
820 err = __set_xattr(ci, newname, name_len, newval,
821 val_len, 1, 1, 1, &xattr);
823 dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL);
824 ci->i_xattrs.dirty = true;
825 inode->i_ctime = CURRENT_TIME;
827 spin_unlock(&ci->i_ceph_lock);
829 __mark_inode_dirty(inode, dirty);
833 spin_unlock(&ci->i_ceph_lock);
834 err = ceph_sync_setxattr(dentry, name, value, size, flags);
842 static int ceph_send_removexattr(struct dentry *dentry, const char *name)
844 struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb);
845 struct ceph_mds_client *mdsc = fsc->mdsc;
846 struct inode *inode = dentry->d_inode;
847 struct inode *parent_inode;
848 struct ceph_mds_request *req;
851 req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_RMXATTR,
855 req->r_inode = inode;
857 req->r_inode_drop = CEPH_CAP_XATTR_SHARED;
859 req->r_path2 = kstrdup(name, GFP_NOFS);
861 parent_inode = ceph_get_dentry_parent_inode(dentry);
862 err = ceph_mdsc_do_request(mdsc, parent_inode, req);
864 ceph_mdsc_put_request(req);
868 int ceph_removexattr(struct dentry *dentry, const char *name)
870 struct inode *inode = dentry->d_inode;
871 struct ceph_vxattr *vxattr;
872 struct ceph_inode_info *ci = ceph_inode(inode);
875 int required_blob_size;
878 if (ceph_snap(inode) != CEPH_NOSNAP)
881 if (!ceph_is_valid_xattr(name))
884 vxattr = ceph_match_vxattr(inode, name);
885 if (vxattr && vxattr->readonly)
889 spin_lock(&ci->i_ceph_lock);
891 issued = __ceph_caps_issued(ci, NULL);
892 dout("removexattr %p issued %s\n", inode, ceph_cap_string(issued));
894 if (!(issued & CEPH_CAP_XATTR_EXCL))
896 __build_xattrs(inode);
898 required_blob_size = __get_required_blob_size(ci, 0, 0);
900 if (!ci->i_xattrs.prealloc_blob ||
901 required_blob_size > ci->i_xattrs.prealloc_blob->alloc_len) {
902 struct ceph_buffer *blob;
904 spin_unlock(&ci->i_ceph_lock);
905 dout(" preaallocating new blob size=%d\n", required_blob_size);
906 blob = ceph_buffer_new(required_blob_size, GFP_NOFS);
909 spin_lock(&ci->i_ceph_lock);
910 if (ci->i_xattrs.prealloc_blob)
911 ceph_buffer_put(ci->i_xattrs.prealloc_blob);
912 ci->i_xattrs.prealloc_blob = blob;
916 err = __remove_xattr_by_name(ceph_inode(inode), name);
918 dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL);
919 ci->i_xattrs.dirty = true;
920 inode->i_ctime = CURRENT_TIME;
921 spin_unlock(&ci->i_ceph_lock);
923 __mark_inode_dirty(inode, dirty);
926 spin_unlock(&ci->i_ceph_lock);
927 err = ceph_send_removexattr(dentry, name);