@@ -710,19 +710,27 @@ ec_setxattr(call_frame_t *frame, xlator_t *this, uintptr_t target,
710710 ec_cbk_t callback = {.setxattr = func };
711711 ec_fop_data_t * fop = NULL ;
712712 int32_t error = ENOMEM ;
713- int ret = 0 ;
714713 data_t * dict_data = NULL ;
715714 char * mask_key = "user.readmask" ;
715+ int ret = 0 ;
716+ int op_ret = -1 ;
716717
717718 gf_msg_trace ("ec" , 0 , "EC(SETXATTR) %p" , frame );
718719
719720 VALIDATE_OR_GOTO (this , out );
720721 GF_VALIDATE_OR_GOTO (this -> name , frame , out );
721722 GF_VALIDATE_OR_GOTO (this -> name , this -> private , out );
722723
723- ret = dict_lookup (dict , mask_key , & data );
724+ ret = dict_lookup (dict , mask_key , & dict_data );
724725 if (!ret && dict_data ){
725-
726+ if (loc != NULL && loc -> inode != NULL ){
727+ loc -> inode -> read_mask = data_to_uint16 (dict_data );
728+ }
729+ dict_deln (dict , mask_key , strlen (mask_key ));
730+ dict_data = NULL ;
731+ error = 0 ;
732+ op_ret = 0 ;
733+ goto out ;
726734 }
727735
728736 fop = ec_fop_data_allocate (frame , this , GF_FOP_SETXATTR , 0 , target ,
@@ -765,7 +773,7 @@ ec_setxattr(call_frame_t *frame, xlator_t *this, uintptr_t target,
765773
766774 ec_t * ec = fop -> xl -> private ;
767775 int64_t val = 0 ;
768- int ret = dict_get_int64 (fop -> dict , SQUOTA_LIMIT_KEY , & val );
776+ ret = dict_get_int64 (fop -> dict , SQUOTA_LIMIT_KEY , & val );
769777 if (IS_SUCCESS (ret )) {
770778 /* divide the total usage to priv->fragments */
771779 int64_t new_value = val / ec -> fragments ;
@@ -783,7 +791,7 @@ ec_setxattr(call_frame_t *frame, xlator_t *this, uintptr_t target,
783791 if (fop != NULL ) {
784792 ec_manager (fop , error );
785793 } else {
786- func (frame , NULL , this , -1 , error , NULL );
794+ func (frame , NULL , this , op_ret , error , NULL );
787795 }
788796}
789797
0 commit comments