@@ -266,7 +266,6 @@ static inline bool _xattr_is_worm_ea(const char *name)
266266static inline bool _xattr_is_stored_vea (const char * name )
267267{
268268 if (strcmp (name , "ltfs.spannedFileOffset" ) &&
269- strcmp (name , "ltfs.mediaPool.name" ) &&
270269 strcasestr (name , "ltfs.permissions." ) != name &&
271270 strcasestr (name , "ltfs.hash." ) != name )
272271 {
@@ -480,6 +479,7 @@ static bool _xattr_is_virtual(struct dentry *d, const char *name, struct ltfs_vo
480479 || ! strcmp (name , "ltfs.mediaIndexPartitionAvailableSpace" )
481480 || ! strcmp (name , "ltfs.mediaEncrypted" )
482481 || ! strcmp (name , "ltfs.mediaPool.additionalInfo" )
482+ || ! strcmp (name , "ltfs.mediaPool.name" )
483483 || ! strcmp (name , "ltfs.driveEncryptionState" )
484484 || ! strcmp (name , "ltfs.driveEncryptionMethod" )
485485 /* Vendor specific EAs */
@@ -787,9 +787,18 @@ static int _xattr_get_virtual(struct dentry *d, char *buf, size_t buf_size, cons
787787 ret = _xattr_get_cartridge_capacity (& cap , & cap .remaining_ip , & val , name , vol );
788788 } else if (! strcmp (name , "ltfs.mediaEncrypted" )) {
789789 ret = xattr_get_string (tape_get_media_encrypted (vol -> device ), & val , name );
790+ } else if (! strcmp (name , "ltfs.mediaPool.name" )) {
791+ char * tmp = NULL ;
792+ ret = tape_get_media_pool_info (vol , & val , & tmp );
793+ if (tmp )
794+ free (tmp );
795+ if (ret < 0 || !val )
796+ ret = - LTFS_NO_XATTR ;
790797 } else if (! strcmp (name , "ltfs.mediaPool.additionalInfo" )) {
791798 char * tmp = NULL ;
792799 ret = tape_get_media_pool_info (vol , & tmp , & val );
800+ if (tmp )
801+ free (tmp );
793802 if (ret < 0 || !val )
794803 ret = - LTFS_NO_XATTR ;
795804 } else if (! strcmp (name , "ltfs.driveEncryptionState" )) {
@@ -1225,6 +1234,8 @@ static int _xattr_set_virtual(struct dentry *d, const char *name, const char *va
12251234 free (v );
12261235 } else if (! strcmp (name , "ltfs.mediaPool.additionalInfo" )) {
12271236 ret = tape_set_media_pool_info (vol , value , size , false);
1237+ } else if (! strcmp (name , "ltfs.mediaPool.name" )) {
1238+ ret = tape_set_media_pool_info (vol , value , size , true);
12281239 } else
12291240 ret = - LTFS_NO_XATTR ;
12301241
@@ -1443,15 +1454,6 @@ int xattr_set(struct dentry *d, const char *name, const char *value, size_t size
14431454 }
14441455 }
14451456
1446- if (!strcmp (name , "ltfs.mediaPool.name" )) {
1447- ret = tape_set_media_pool_info (vol , value , size , true);
1448- if (ret < 0 ) {
1449- releasewrite_mrsw (& d -> meta_lock );
1450- goto out_unlock ;
1451- }
1452- write_idx = true;
1453- }
1454-
14551457 /* Set extended attribute */
14561458 ret = xattr_do_set (d , name , value , size , xattr );
14571459 if (ret < 0 ) {
0 commit comments