Commit 8131088c authored by Leigh B Stoller's avatar Leigh B Stoller

Add ZFS_NOEXPORT flag, which tells exports_setup to explicitly export

ACTIVE proj, group and users directories to boss, in leu of automatic ZFS
exports off all directories. On Utah Boss, that amounts to many 1000s of
exports (7000?), which causes all NFS traffic to suspend for a long time.
parent f955e73e
...@@ -663,6 +663,7 @@ ZFS_QUOTA_GROUP ...@@ -663,6 +663,7 @@ ZFS_QUOTA_GROUP
ZFS_QUOTA_PROJECT ZFS_QUOTA_PROJECT
ZFS_QUOTA_USER ZFS_QUOTA_USER
ZFS_ROOT ZFS_ROOT
ZFS_NOEXPORT
WITHZFS WITHZFS
NOVIRTNFSMOUNTS NOVIRTNFSMOUNTS
PROFILEVERSIONS PROFILEVERSIONS
...@@ -5126,6 +5127,7 @@ ZFS_ROOT=z ...@@ -5126,6 +5127,7 @@ ZFS_ROOT=z
ZFS_QUOTA_USER="1G" ZFS_QUOTA_USER="1G"
ZFS_QUOTA_PROJECT="100G" ZFS_QUOTA_PROJECT="100G"
ZFS_QUOTA_GROUP="10G" ZFS_QUOTA_GROUP="10G"
ZFS_NOEXPORT=0
WITHAMD=0 WITHAMD=0
AMD_ROOT=/.amd_mnt AMD_ROOT=/.amd_mnt
BS_IQN_PREFIX=iqn.2000-10.net.emulab BS_IQN_PREFIX=iqn.2000-10.net.emulab
......
...@@ -301,6 +301,7 @@ AC_SUBST(ZFS_ROOT) ...@@ -301,6 +301,7 @@ AC_SUBST(ZFS_ROOT)
AC_SUBST(ZFS_QUOTA_USER) AC_SUBST(ZFS_QUOTA_USER)
AC_SUBST(ZFS_QUOTA_PROJECT) AC_SUBST(ZFS_QUOTA_PROJECT)
AC_SUBST(ZFS_QUOTA_GROUP) AC_SUBST(ZFS_QUOTA_GROUP)
AC_SUBST(ZFS_NOEXPORT)
AC_SUBST(WITHAMD) AC_SUBST(WITHAMD)
AC_SUBST(AMD_ROOT) AC_SUBST(AMD_ROOT)
AC_SUBST(BS_IQN_PREFIX) AC_SUBST(BS_IQN_PREFIX)
...@@ -455,6 +456,7 @@ ZFS_ROOT=z ...@@ -455,6 +456,7 @@ ZFS_ROOT=z
ZFS_QUOTA_USER="1G" ZFS_QUOTA_USER="1G"
ZFS_QUOTA_PROJECT="100G" ZFS_QUOTA_PROJECT="100G"
ZFS_QUOTA_GROUP="10G" ZFS_QUOTA_GROUP="10G"
ZFS_NOEXPORT=0
WITHAMD=0 WITHAMD=0
AMD_ROOT=/.amd_mnt AMD_ROOT=/.amd_mnt
BS_IQN_PREFIX=iqn.2000-10.net.emulab BS_IQN_PREFIX=iqn.2000-10.net.emulab
......
...@@ -56,6 +56,7 @@ sub fsof($); ...@@ -56,6 +56,7 @@ sub fsof($);
my $TB = "@prefix@"; my $TB = "@prefix@";
my $TBOPS = "@TBOPSEMAIL@"; my $TBOPS = "@TBOPSEMAIL@";
my $TESTMODE = @TESTMODE@; my $TESTMODE = @TESTMODE@;
my $BOSSNODE = "@BOSSNODE@";
my $FSNODE = "@FSNODE@"; my $FSNODE = "@FSNODE@";
my $projdir = "@FSDIR_PROJ@"; my $projdir = "@FSDIR_PROJ@";
my $usersdir = "@FSDIR_USERS@"; my $usersdir = "@FSDIR_USERS@";
...@@ -68,6 +69,7 @@ my $NOSHAREDFS = @NOSHAREDFS@; ...@@ -68,6 +69,7 @@ my $NOSHAREDFS = @NOSHAREDFS@;
my $LINUX_FSNODE= @LINUX_FSNODE@; my $LINUX_FSNODE= @LINUX_FSNODE@;
my $NFSMAPTOUSER= "@NFSMAPTOUSER@"; my $NFSMAPTOUSER= "@NFSMAPTOUSER@";
my $WITHZFS = @WITHZFS@; my $WITHZFS = @WITHZFS@;
my $ZFS_NOEXPORT= @ZFS_NOEXPORT@;
# XXX for TESTMODE: output to stdout # XXX for TESTMODE: output to stdout
my $TOSTDOUT = 0; my $TOSTDOUT = 0;
...@@ -214,6 +216,34 @@ $nodes_result = ...@@ -214,6 +216,34 @@ $nodes_result =
" and nt.isremotenode=0 ". " and nt.isremotenode=0 ".
"order by r.pid,e.gid,r.eid,u.admin,n.priority"); "order by r.pid,e.gid,r.eid,u.admin,n.priority");
#
# ZFS, without automatic exports of all /users; need to explicitly export
# user directories to boss. First get all web active and admins, and below
# we will add all other user exports to the list.
#
my $bossexports = ();
if ($WITHZFS && $ZFS_NOEXPORT) {
#
# Find all web active users within last seven days, plus all admins.
#
my $limit = (60 * 60 * 24) * 7;
my $active_result =
DBQueryFatal("select distinct u.uid,m.pid from user_stats as s ".
"left join users as u on u.uid_idx=s.uid_idx ".
"left join group_membership as m on ".
" m.uid_idx=u.uid_idx and m.pid=m.gid ".
"where ((UNIX_TIMESTAMP(now()) - ".
" UNIX_TIMESTAMP(s.last_activity)) <= $limit) or ".
" admin=1");
while (my ($uid,$pid) = $active_result->fetchrow_array()) {
$bossexports{"$usersdir/$uid"} = "$usersdir/$uid";
$bossexports{"$projdir/$pid"} = "$projdir/$pid";
$bossexports{"$groupdir/$pid"} = "$groupdir/$pid";
}
}
my %ipgroups = (); my %ipgroups = ();
my %globalsmbshares = (); my %globalsmbshares = ();
my %lastfslist = (); my %lastfslist = ();
...@@ -314,6 +344,10 @@ while ($row = $nodes_result->fetchrow_hashref) { ...@@ -314,6 +344,10 @@ while ($row = $nodes_result->fetchrow_hashref) {
"$GROUPROOT/$pid/$gid does not exist!\n"; "$GROUPROOT/$pid/$gid does not exist!\n";
} }
} }
if ($ZFS_NOEXPORT && $gid eq $pid) {
$bossexports{"$projdir/$pid"} = "$projdir/$pid";
$bossexports{"$groupdir/$pid"} = "$groupdir/$pid";
}
if ($scratchdir && -d "$SCRATCHROOT/$pid") { if ($scratchdir && -d "$SCRATCHROOT/$pid") {
push(@dirlist, "$scratchdir/$pid"); push(@dirlist, "$scratchdir/$pid");
...@@ -352,6 +386,10 @@ while ($row = $nodes_result->fetchrow_hashref) { ...@@ -352,6 +386,10 @@ while ($row = $nodes_result->fetchrow_hashref) {
print STDERR "*** exports_setup: ". print STDERR "*** exports_setup: ".
"$USERROOT/$uid does not exist!\n"; "$USERROOT/$uid does not exist!\n";
} }
if ($ZFS_NOEXPORT) {
$bossexports{"$usersdir/$uid"} = "$usersdir/$uid";
}
} }
} }
skip: skip:
...@@ -436,6 +474,20 @@ foreach my $str ( keys(%ipgroups) ) { ...@@ -436,6 +474,20 @@ foreach my $str ( keys(%ipgroups) ) {
if ($debug); if ($debug);
} }
} }
if ($ZFS_NOEXPORT) {
my $str = join(" ", keys(%bossexports));
if ($LINUX_FSNODE) {
print MAP "$str -rw,no_root_squash,no_subtree_check $BOSSNODE\n";
print "$str -rw,no_root_squash,no_subtree_check $BOSSNODE\n"
if ($debug);
}
else {
print MAP "$str -maproot=$NFSMAPTOUSER $BOSSNODE\n";
print "$str -maproot=$NFSMAPTOUSER $BOSSNODE\n"
if ($debug);
}
}
print MAP "\n"; print MAP "\n";
close(MAP); close(MAP);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment