Changeset 24276 for trunk/Nebulous-Server
- Timestamp:
- May 29, 2009, 12:21:43 PM (17 years ago)
- Location:
- trunk/Nebulous-Server
- Files:
-
- 1 added
- 3 edited
-
Changes (modified) (1 diff)
-
MANIFEST (modified) (1 diff)
-
lib/Nebulous/Server.pm (modified) (2 diffs)
-
t/17_server_chmod_object.t (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous-Server/Changes
r23932 r24276 2 2 3 3 0.17 4 - add chmod_object() method 4 5 - retry database transactions when a deadlock is detected 5 6 - add log4perl logging to nebdiskd -
trunk/Nebulous-Server/MANIFEST
r23932 r24276 48 48 t/15_mounts.t 49 49 t/16_server_swap_objects.t 50 t/17_server_chmod_object.t 50 51 t/75_parse_neb_key.t -
trunk/Nebulous-Server/lib/Nebulous/Server.pm
r23932 r24276 15 15 use DBI; 16 16 use Digest::SHA1 qw( sha1_hex ); 17 use Fcntl ':mode'; 17 18 use File::Basename qw( basename dirname fileparse ); 18 19 use File::ExtAttr qw( setfattr ); … … 1576 1577 } 1577 1578 1579 sub chmod_object 1580 { 1581 my $self = shift; 1582 1583 my ($key, $mode) = validate_pos( @_, 1584 { 1585 type => SCALAR, 1586 callbacks => { 1587 'is valid object key' => sub { $self->_is_valid_object_key($_[0]) }, 1588 }, 1589 }, 1590 { 1591 type => SCALAR, 1592 regex => qr/\d{3,4}/, 1593 callbacks => { 1594 'is allowable mode' => sub { 1595 $_[0] == (S_IRUSR | S_IRGRP) 1596 }, 1597 }, 1598 }, 1599 ); 1600 1601 # ignore volume 1602 $key = parse_neb_key($key); 1603 1604 my $log = $self->log; 1605 my $sql = $self->sql; 1606 my $db = $self->db($key); 1607 1608 $log->debug("entered - @_"); 1609 1610 # find all instances of this object 1611 my $locations; 1612 eval { 1613 $locations = $self->find_instances("$key"); 1614 }; 1615 $log->logdie("error: $@") if $@; 1616 1617 # update each instances 1618 foreach my $inst (@$locations) { 1619 chmod $mode, URI->new($inst)->path 1620 or $log->logdie("chmod() failed: $!"); 1621 } 1622 1623 # stick an xattr on this object with the mode 1624 # XXX this would probably be better as a field in the storage_object_attr 1625 # table but since we're not planning to use this for very many objects (as 1626 # a %) it may not be worth adding the extra field at this time. 1627 eval { 1628 $self->setxattr_object("$key", 'user.mode', $mode, 'replace'); 1629 }; 1630 $log->logdie("error: $@") if $@; 1631 1632 $log->debug("leaving"); 1633 1634 return $mode; 1635 } 1578 1636 1579 1637 sub _get_storage_volume
Note:
See TracChangeset
for help on using the changeset viewer.
