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 static bool ceph_is_valid_xattr(const char *name
)
13 return !strncmp(name
, "ceph.", 5) ||
14 !strncmp(name
, XATTR_SECURITY_PREFIX
,
15 XATTR_SECURITY_PREFIX_LEN
) ||
16 !strncmp(name
, XATTR_TRUSTED_PREFIX
, XATTR_TRUSTED_PREFIX_LEN
) ||
17 !strncmp(name
, XATTR_USER_PREFIX
, XATTR_USER_PREFIX_LEN
);
21 * These define virtual xattrs exposing the recursive directory
22 * statistics and layout metadata.
24 struct ceph_vxattr_cb
{
27 size_t (*getxattr_cb
)(struct ceph_inode_info
*ci
, char *val
,
33 static size_t ceph_vxattrcb_entries(struct ceph_inode_info
*ci
, char *val
,
36 return snprintf(val
, size
, "%lld", ci
->i_files
+ ci
->i_subdirs
);
39 static size_t ceph_vxattrcb_files(struct ceph_inode_info
*ci
, char *val
,
42 return snprintf(val
, size
, "%lld", ci
->i_files
);
45 static size_t ceph_vxattrcb_subdirs(struct ceph_inode_info
*ci
, char *val
,
48 return snprintf(val
, size
, "%lld", ci
->i_subdirs
);
51 static size_t ceph_vxattrcb_rentries(struct ceph_inode_info
*ci
, char *val
,
54 return snprintf(val
, size
, "%lld", ci
->i_rfiles
+ ci
->i_rsubdirs
);
57 static size_t ceph_vxattrcb_rfiles(struct ceph_inode_info
*ci
, char *val
,
60 return snprintf(val
, size
, "%lld", ci
->i_rfiles
);
63 static size_t ceph_vxattrcb_rsubdirs(struct ceph_inode_info
*ci
, char *val
,
66 return snprintf(val
, size
, "%lld", ci
->i_rsubdirs
);
69 static size_t ceph_vxattrcb_rbytes(struct ceph_inode_info
*ci
, char *val
,
72 return snprintf(val
, size
, "%lld", ci
->i_rbytes
);
75 static size_t ceph_vxattrcb_rctime(struct ceph_inode_info
*ci
, char *val
,
78 return snprintf(val
, size
, "%ld.%ld", (long)ci
->i_rctime
.tv_sec
,
79 (long)ci
->i_rctime
.tv_nsec
);
82 static struct ceph_vxattr_cb ceph_dir_vxattrs
[] = {
83 { true, "ceph.dir.entries", ceph_vxattrcb_entries
},
84 { true, "ceph.dir.files", ceph_vxattrcb_files
},
85 { true, "ceph.dir.subdirs", ceph_vxattrcb_subdirs
},
86 { true, "ceph.dir.rentries", ceph_vxattrcb_rentries
},
87 { true, "ceph.dir.rfiles", ceph_vxattrcb_rfiles
},
88 { true, "ceph.dir.rsubdirs", ceph_vxattrcb_rsubdirs
},
89 { true, "ceph.dir.rbytes", ceph_vxattrcb_rbytes
},
90 { true, "ceph.dir.rctime", ceph_vxattrcb_rctime
},
96 static size_t ceph_vxattrcb_layout(struct ceph_inode_info
*ci
, char *val
,
101 ret
= snprintf(val
, size
,
102 "chunk_bytes=%lld\nstripe_count=%lld\nobject_size=%lld\n",
103 (unsigned long long)ceph_file_layout_su(ci
->i_layout
),
104 (unsigned long long)ceph_file_layout_stripe_count(ci
->i_layout
),
105 (unsigned long long)ceph_file_layout_object_size(ci
->i_layout
));
106 if (ceph_file_layout_pg_preferred(ci
->i_layout
))
107 ret
+= snprintf(val
+ ret
, size
, "preferred_osd=%lld\n",
108 (unsigned long long)ceph_file_layout_pg_preferred(
113 static struct ceph_vxattr_cb ceph_file_vxattrs
[] = {
114 { true, "ceph.layout", ceph_vxattrcb_layout
},
118 static struct ceph_vxattr_cb
*ceph_inode_vxattrs(struct inode
*inode
)
120 if (S_ISDIR(inode
->i_mode
))
121 return ceph_dir_vxattrs
;
122 else if (S_ISREG(inode
->i_mode
))
123 return ceph_file_vxattrs
;
127 static struct ceph_vxattr_cb
*ceph_match_vxattr(struct ceph_vxattr_cb
*vxattr
,
131 if (strcmp(vxattr
->name
, name
) == 0)
134 } while (vxattr
->name
);
138 static int __set_xattr(struct ceph_inode_info
*ci
,
139 const char *name
, int name_len
,
140 const char *val
, int val_len
,
142 int should_free_name
, int should_free_val
,
143 struct ceph_inode_xattr
**newxattr
)
146 struct rb_node
*parent
= NULL
;
147 struct ceph_inode_xattr
*xattr
= NULL
;
151 p
= &ci
->i_xattrs
.index
.rb_node
;
154 xattr
= rb_entry(parent
, struct ceph_inode_xattr
, node
);
155 c
= strncmp(name
, xattr
->name
, min(name_len
, xattr
->name_len
));
161 if (name_len
== xattr
->name_len
)
163 else if (name_len
< xattr
->name_len
)
175 xattr
->name_len
= name_len
;
176 xattr
->should_free_name
= should_free_name
;
178 ci
->i_xattrs
.count
++;
179 dout("__set_xattr count=%d\n", ci
->i_xattrs
.count
);
183 if (xattr
->should_free_val
)
184 kfree((void *)xattr
->val
);
186 if (should_free_name
) {
190 ci
->i_xattrs
.names_size
-= xattr
->name_len
;
191 ci
->i_xattrs
.vals_size
-= xattr
->val_len
;
193 ci
->i_xattrs
.names_size
+= name_len
;
194 ci
->i_xattrs
.vals_size
+= val_len
;
200 xattr
->val_len
= val_len
;
201 xattr
->dirty
= dirty
;
202 xattr
->should_free_val
= (val
&& should_free_val
);
205 rb_link_node(&xattr
->node
, parent
, p
);
206 rb_insert_color(&xattr
->node
, &ci
->i_xattrs
.index
);
207 dout("__set_xattr_val p=%p\n", p
);
210 dout("__set_xattr_val added %llx.%llx xattr %p %s=%.*s\n",
211 ceph_vinop(&ci
->vfs_inode
), xattr
, name
, val_len
, val
);
216 static struct ceph_inode_xattr
*__get_xattr(struct ceph_inode_info
*ci
,
220 struct rb_node
*parent
= NULL
;
221 struct ceph_inode_xattr
*xattr
= NULL
;
224 p
= &ci
->i_xattrs
.index
.rb_node
;
227 xattr
= rb_entry(parent
, struct ceph_inode_xattr
, node
);
228 c
= strncmp(name
, xattr
->name
, xattr
->name_len
);
234 dout("__get_xattr %s: found %.*s\n", name
,
235 xattr
->val_len
, xattr
->val
);
240 dout("__get_xattr %s: not found\n", name
);
245 static void __free_xattr(struct ceph_inode_xattr
*xattr
)
249 if (xattr
->should_free_name
)
250 kfree((void *)xattr
->name
);
251 if (xattr
->should_free_val
)
252 kfree((void *)xattr
->val
);
257 static int __remove_xattr(struct ceph_inode_info
*ci
,
258 struct ceph_inode_xattr
*xattr
)
263 rb_erase(&xattr
->node
, &ci
->i_xattrs
.index
);
265 if (xattr
->should_free_name
)
266 kfree((void *)xattr
->name
);
267 if (xattr
->should_free_val
)
268 kfree((void *)xattr
->val
);
270 ci
->i_xattrs
.names_size
-= xattr
->name_len
;
271 ci
->i_xattrs
.vals_size
-= xattr
->val_len
;
272 ci
->i_xattrs
.count
--;
278 static int __remove_xattr_by_name(struct ceph_inode_info
*ci
,
282 struct ceph_inode_xattr
*xattr
;
285 p
= &ci
->i_xattrs
.index
.rb_node
;
286 xattr
= __get_xattr(ci
, name
);
287 err
= __remove_xattr(ci
, xattr
);
291 static char *__copy_xattr_names(struct ceph_inode_info
*ci
,
295 struct ceph_inode_xattr
*xattr
= NULL
;
297 p
= rb_first(&ci
->i_xattrs
.index
);
298 dout("__copy_xattr_names count=%d\n", ci
->i_xattrs
.count
);
301 xattr
= rb_entry(p
, struct ceph_inode_xattr
, node
);
302 memcpy(dest
, xattr
->name
, xattr
->name_len
);
303 dest
[xattr
->name_len
] = '\0';
305 dout("dest=%s %p (%s) (%d/%d)\n", dest
, xattr
, xattr
->name
,
306 xattr
->name_len
, ci
->i_xattrs
.names_size
);
308 dest
+= xattr
->name_len
+ 1;
315 void __ceph_destroy_xattrs(struct ceph_inode_info
*ci
)
317 struct rb_node
*p
, *tmp
;
318 struct ceph_inode_xattr
*xattr
= NULL
;
320 p
= rb_first(&ci
->i_xattrs
.index
);
322 dout("__ceph_destroy_xattrs p=%p\n", p
);
325 xattr
= rb_entry(p
, struct ceph_inode_xattr
, node
);
328 dout("__ceph_destroy_xattrs next p=%p (%.*s)\n", p
,
329 xattr
->name_len
, xattr
->name
);
330 rb_erase(tmp
, &ci
->i_xattrs
.index
);
335 ci
->i_xattrs
.names_size
= 0;
336 ci
->i_xattrs
.vals_size
= 0;
337 ci
->i_xattrs
.index_version
= 0;
338 ci
->i_xattrs
.count
= 0;
339 ci
->i_xattrs
.index
= RB_ROOT
;
342 static int __build_xattrs(struct inode
*inode
)
343 __releases(inode
->i_lock
)
344 __acquires(inode
->i_lock
)
350 const char *name
, *val
;
351 struct ceph_inode_info
*ci
= ceph_inode(inode
);
353 struct ceph_inode_xattr
**xattrs
= NULL
;
357 dout("__build_xattrs() len=%d\n",
358 ci
->i_xattrs
.blob
? (int)ci
->i_xattrs
.blob
->vec
.iov_len
: 0);
360 if (ci
->i_xattrs
.index_version
>= ci
->i_xattrs
.version
)
361 return 0; /* already built */
363 __ceph_destroy_xattrs(ci
);
366 /* updated internal xattr rb tree */
367 if (ci
->i_xattrs
.blob
&& ci
->i_xattrs
.blob
->vec
.iov_len
> 4) {
368 p
= ci
->i_xattrs
.blob
->vec
.iov_base
;
369 end
= p
+ ci
->i_xattrs
.blob
->vec
.iov_len
;
370 ceph_decode_32_safe(&p
, end
, numattr
, bad
);
371 xattr_version
= ci
->i_xattrs
.version
;
372 spin_unlock(&inode
->i_lock
);
374 xattrs
= kcalloc(numattr
, sizeof(struct ceph_xattr
*),
379 memset(xattrs
, 0, numattr
*sizeof(struct ceph_xattr
*));
380 for (i
= 0; i
< numattr
; i
++) {
381 xattrs
[i
] = kmalloc(sizeof(struct ceph_inode_xattr
),
387 spin_lock(&inode
->i_lock
);
388 if (ci
->i_xattrs
.version
!= xattr_version
) {
389 /* lost a race, retry */
390 for (i
= 0; i
< numattr
; i
++)
397 ceph_decode_32_safe(&p
, end
, len
, bad
);
401 ceph_decode_32_safe(&p
, end
, len
, bad
);
405 err
= __set_xattr(ci
, name
, namelen
, val
, len
,
406 0, 0, 0, &xattrs
[numattr
]);
413 ci
->i_xattrs
.index_version
= ci
->i_xattrs
.version
;
414 ci
->i_xattrs
.dirty
= false;
418 spin_lock(&inode
->i_lock
);
421 for (i
= 0; i
< numattr
; i
++)
425 ci
->i_xattrs
.names_size
= 0;
429 static int __get_required_blob_size(struct ceph_inode_info
*ci
, int name_size
,
433 * 4 bytes for the length, and additional 4 bytes per each xattr name,
434 * 4 bytes per each value
436 int size
= 4 + ci
->i_xattrs
.count
*(4 + 4) +
437 ci
->i_xattrs
.names_size
+
438 ci
->i_xattrs
.vals_size
;
439 dout("__get_required_blob_size c=%d names.size=%d vals.size=%d\n",
440 ci
->i_xattrs
.count
, ci
->i_xattrs
.names_size
,
441 ci
->i_xattrs
.vals_size
);
444 size
+= 4 + 4 + name_size
+ val_size
;
450 * If there are dirty xattrs, reencode xattrs into the prealloc_blob
451 * and swap into place.
453 void __ceph_build_xattrs_blob(struct ceph_inode_info
*ci
)
456 struct ceph_inode_xattr
*xattr
= NULL
;
459 dout("__build_xattrs_blob %p\n", &ci
->vfs_inode
);
460 if (ci
->i_xattrs
.dirty
) {
461 int need
= __get_required_blob_size(ci
, 0, 0);
463 BUG_ON(need
> ci
->i_xattrs
.prealloc_blob
->alloc_len
);
465 p
= rb_first(&ci
->i_xattrs
.index
);
466 dest
= ci
->i_xattrs
.prealloc_blob
->vec
.iov_base
;
468 ceph_encode_32(&dest
, ci
->i_xattrs
.count
);
470 xattr
= rb_entry(p
, struct ceph_inode_xattr
, node
);
472 ceph_encode_32(&dest
, xattr
->name_len
);
473 memcpy(dest
, xattr
->name
, xattr
->name_len
);
474 dest
+= xattr
->name_len
;
475 ceph_encode_32(&dest
, xattr
->val_len
);
476 memcpy(dest
, xattr
->val
, xattr
->val_len
);
477 dest
+= xattr
->val_len
;
482 /* adjust buffer len; it may be larger than we need */
483 ci
->i_xattrs
.prealloc_blob
->vec
.iov_len
=
484 dest
- ci
->i_xattrs
.prealloc_blob
->vec
.iov_base
;
486 if (ci
->i_xattrs
.blob
)
487 ceph_buffer_put(ci
->i_xattrs
.blob
);
488 ci
->i_xattrs
.blob
= ci
->i_xattrs
.prealloc_blob
;
489 ci
->i_xattrs
.prealloc_blob
= NULL
;
490 ci
->i_xattrs
.dirty
= false;
491 ci
->i_xattrs
.version
++;
495 ssize_t
ceph_getxattr(struct dentry
*dentry
, const char *name
, void *value
,
498 struct inode
*inode
= dentry
->d_inode
;
499 struct ceph_inode_info
*ci
= ceph_inode(inode
);
500 struct ceph_vxattr_cb
*vxattrs
= ceph_inode_vxattrs(inode
);
502 struct ceph_inode_xattr
*xattr
;
503 struct ceph_vxattr_cb
*vxattr
= NULL
;
505 if (!ceph_is_valid_xattr(name
))
508 /* let's see if a virtual xattr was requested */
510 vxattr
= ceph_match_vxattr(vxattrs
, name
);
512 spin_lock(&inode
->i_lock
);
513 dout("getxattr %p ver=%lld index_ver=%lld\n", inode
,
514 ci
->i_xattrs
.version
, ci
->i_xattrs
.index_version
);
516 if (__ceph_caps_issued_mask(ci
, CEPH_CAP_XATTR_SHARED
, 1) &&
517 (ci
->i_xattrs
.index_version
>= ci
->i_xattrs
.version
)) {
520 spin_unlock(&inode
->i_lock
);
521 /* get xattrs from mds (if we don't already have them) */
522 err
= ceph_do_getattr(inode
, CEPH_STAT_CAP_XATTR
);
527 spin_lock(&inode
->i_lock
);
529 if (vxattr
&& vxattr
->readonly
) {
530 err
= vxattr
->getxattr_cb(ci
, value
, size
);
534 err
= __build_xattrs(inode
);
539 err
= -ENODATA
; /* == ENOATTR */
540 xattr
= __get_xattr(ci
, name
);
543 err
= vxattr
->getxattr_cb(ci
, value
, size
);
548 if (size
&& size
< xattr
->val_len
)
551 err
= xattr
->val_len
;
555 memcpy(value
, xattr
->val
, xattr
->val_len
);
558 spin_unlock(&inode
->i_lock
);
562 ssize_t
ceph_listxattr(struct dentry
*dentry
, char *names
, size_t size
)
564 struct inode
*inode
= dentry
->d_inode
;
565 struct ceph_inode_info
*ci
= ceph_inode(inode
);
566 struct ceph_vxattr_cb
*vxattrs
= ceph_inode_vxattrs(inode
);
573 spin_lock(&inode
->i_lock
);
574 dout("listxattr %p ver=%lld index_ver=%lld\n", inode
,
575 ci
->i_xattrs
.version
, ci
->i_xattrs
.index_version
);
577 if (__ceph_caps_issued_mask(ci
, CEPH_CAP_XATTR_SHARED
, 1) &&
578 (ci
->i_xattrs
.index_version
>= ci
->i_xattrs
.version
)) {
581 spin_unlock(&inode
->i_lock
);
582 err
= ceph_do_getattr(inode
, CEPH_STAT_CAP_XATTR
);
587 spin_lock(&inode
->i_lock
);
589 err
= __build_xattrs(inode
);
595 /* include virtual dir xattrs */
597 for (i
= 0; vxattrs
[i
].name
; i
++)
598 vir_namelen
+= strlen(vxattrs
[i
].name
) + 1;
599 /* adding 1 byte per each variable due to the null termination */
600 namelen
= vir_namelen
+ ci
->i_xattrs
.names_size
+ ci
->i_xattrs
.count
;
602 if (size
&& namelen
> size
)
609 names
= __copy_xattr_names(ci
, names
);
611 /* virtual xattr names, too */
613 for (i
= 0; vxattrs
[i
].name
; i
++) {
614 len
= sprintf(names
, "%s", vxattrs
[i
].name
);
619 spin_unlock(&inode
->i_lock
);
623 static int ceph_sync_setxattr(struct dentry
*dentry
, const char *name
,
624 const char *value
, size_t size
, int flags
)
626 struct ceph_fs_client
*fsc
= ceph_sb_to_client(dentry
->d_sb
);
627 struct inode
*inode
= dentry
->d_inode
;
628 struct ceph_inode_info
*ci
= ceph_inode(inode
);
629 struct inode
*parent_inode
= dentry
->d_parent
->d_inode
;
630 struct ceph_mds_request
*req
;
631 struct ceph_mds_client
*mdsc
= fsc
->mdsc
;
634 struct page
**pages
= NULL
;
637 /* copy value into some pages */
638 nr_pages
= calc_pages_for(0, size
);
640 pages
= kmalloc(sizeof(pages
[0])*nr_pages
, GFP_NOFS
);
644 for (i
= 0; i
< nr_pages
; i
++) {
645 pages
[i
] = __page_cache_alloc(GFP_NOFS
);
650 kaddr
= kmap(pages
[i
]);
651 memcpy(kaddr
, value
+ i
*PAGE_CACHE_SIZE
,
652 min(PAGE_CACHE_SIZE
, size
-i
*PAGE_CACHE_SIZE
));
656 dout("setxattr value=%.*s\n", (int)size
, value
);
659 req
= ceph_mdsc_create_request(mdsc
, CEPH_MDS_OP_SETXATTR
,
665 req
->r_inode
= igrab(inode
);
666 req
->r_inode_drop
= CEPH_CAP_XATTR_SHARED
;
668 req
->r_args
.setxattr
.flags
= cpu_to_le32(flags
);
669 req
->r_path2
= kstrdup(name
, GFP_NOFS
);
671 req
->r_pages
= pages
;
672 req
->r_num_pages
= nr_pages
;
673 req
->r_data_len
= size
;
675 dout("xattr.ver (before): %lld\n", ci
->i_xattrs
.version
);
676 err
= ceph_mdsc_do_request(mdsc
, parent_inode
, req
);
677 ceph_mdsc_put_request(req
);
678 dout("xattr.ver (after): %lld\n", ci
->i_xattrs
.version
);
682 for (i
= 0; i
< nr_pages
; i
++)
683 __free_page(pages
[i
]);
689 int ceph_setxattr(struct dentry
*dentry
, const char *name
,
690 const void *value
, size_t size
, int flags
)
692 struct inode
*inode
= dentry
->d_inode
;
693 struct ceph_inode_info
*ci
= ceph_inode(inode
);
694 struct ceph_vxattr_cb
*vxattrs
= ceph_inode_vxattrs(inode
);
696 int name_len
= strlen(name
);
698 char *newname
= NULL
;
700 struct ceph_inode_xattr
*xattr
= NULL
;
702 int required_blob_size
;
704 if (ceph_snap(inode
) != CEPH_NOSNAP
)
707 if (!ceph_is_valid_xattr(name
))
711 struct ceph_vxattr_cb
*vxattr
=
712 ceph_match_vxattr(vxattrs
, name
);
713 if (vxattr
&& vxattr
->readonly
)
717 /* preallocate memory for xattr name, value, index node */
719 newname
= kmemdup(name
, name_len
+ 1, GFP_NOFS
);
724 newval
= kmalloc(val_len
+ 1, GFP_NOFS
);
727 memcpy(newval
, value
, val_len
);
728 newval
[val_len
] = '\0';
731 xattr
= kmalloc(sizeof(struct ceph_inode_xattr
), GFP_NOFS
);
735 spin_lock(&inode
->i_lock
);
737 issued
= __ceph_caps_issued(ci
, NULL
);
738 if (!(issued
& CEPH_CAP_XATTR_EXCL
))
740 __build_xattrs(inode
);
742 required_blob_size
= __get_required_blob_size(ci
, name_len
, val_len
);
744 if (!ci
->i_xattrs
.prealloc_blob
||
745 required_blob_size
> ci
->i_xattrs
.prealloc_blob
->alloc_len
) {
746 struct ceph_buffer
*blob
= NULL
;
748 spin_unlock(&inode
->i_lock
);
749 dout(" preaallocating new blob size=%d\n", required_blob_size
);
750 blob
= ceph_buffer_new(required_blob_size
, GFP_NOFS
);
753 spin_lock(&inode
->i_lock
);
754 if (ci
->i_xattrs
.prealloc_blob
)
755 ceph_buffer_put(ci
->i_xattrs
.prealloc_blob
);
756 ci
->i_xattrs
.prealloc_blob
= blob
;
760 dout("setxattr %p issued %s\n", inode
, ceph_cap_string(issued
));
761 err
= __set_xattr(ci
, newname
, name_len
, newval
,
762 val_len
, 1, 1, 1, &xattr
);
763 __ceph_mark_dirty_caps(ci
, CEPH_CAP_XATTR_EXCL
);
764 ci
->i_xattrs
.dirty
= true;
765 inode
->i_ctime
= CURRENT_TIME
;
766 spin_unlock(&inode
->i_lock
);
771 spin_unlock(&inode
->i_lock
);
772 err
= ceph_sync_setxattr(dentry
, name
, value
, size
, flags
);
780 static int ceph_send_removexattr(struct dentry
*dentry
, const char *name
)
782 struct ceph_fs_client
*fsc
= ceph_sb_to_client(dentry
->d_sb
);
783 struct ceph_mds_client
*mdsc
= fsc
->mdsc
;
784 struct inode
*inode
= dentry
->d_inode
;
785 struct inode
*parent_inode
= dentry
->d_parent
->d_inode
;
786 struct ceph_mds_request
*req
;
789 req
= ceph_mdsc_create_request(mdsc
, CEPH_MDS_OP_RMXATTR
,
793 req
->r_inode
= igrab(inode
);
794 req
->r_inode_drop
= CEPH_CAP_XATTR_SHARED
;
796 req
->r_path2
= kstrdup(name
, GFP_NOFS
);
798 err
= ceph_mdsc_do_request(mdsc
, parent_inode
, req
);
799 ceph_mdsc_put_request(req
);
803 int ceph_removexattr(struct dentry
*dentry
, const char *name
)
805 struct inode
*inode
= dentry
->d_inode
;
806 struct ceph_inode_info
*ci
= ceph_inode(inode
);
807 struct ceph_vxattr_cb
*vxattrs
= ceph_inode_vxattrs(inode
);
811 if (ceph_snap(inode
) != CEPH_NOSNAP
)
814 if (!ceph_is_valid_xattr(name
))
818 struct ceph_vxattr_cb
*vxattr
=
819 ceph_match_vxattr(vxattrs
, name
);
820 if (vxattr
&& vxattr
->readonly
)
824 spin_lock(&inode
->i_lock
);
825 __build_xattrs(inode
);
826 issued
= __ceph_caps_issued(ci
, NULL
);
827 dout("removexattr %p issued %s\n", inode
, ceph_cap_string(issued
));
829 if (!(issued
& CEPH_CAP_XATTR_EXCL
))
832 err
= __remove_xattr_by_name(ceph_inode(inode
), name
);
833 __ceph_mark_dirty_caps(ci
, CEPH_CAP_XATTR_EXCL
);
834 ci
->i_xattrs
.dirty
= true;
835 inode
->i_ctime
= CURRENT_TIME
;
837 spin_unlock(&inode
->i_lock
);
841 spin_unlock(&inode
->i_lock
);
842 err
= ceph_send_removexattr(dentry
, name
);