Skip to content

Commit

Permalink
pnfsmanager: log problems when creating upload directory
Browse files Browse the repository at this point in the history
Currently, if there is a problem creating the upload directory
(for example, if the permissions for /upload is wrong) then a
CacheException is thrown, propagated to SRM, which converts this
to SRMInternalErrorException, which fails the request but without
logging the problem.

Since, in these cases, direct admin intervention is needed to fix
the problem, it makes sense that this is logged.

This patch will log situations that point to admin-related
mistakes or where admin intevention is likely needed.

Target: master
Require-notes: no
Require-book: no
Request: 2.11
Request: 2.10
Acked-by: Tigran Mkrtchyan
Patch: https://rb.dcache.org/r/7804/
  • Loading branch information
paulmillar committed Feb 13, 2015
1 parent adf3ae1 commit c550606
Showing 1 changed file with 8 additions and 5 deletions.
Expand Up @@ -143,7 +143,7 @@ public void setAtimeGap(long gap) {
}

private FsInode pathToInode(Subject subject, String path)
throws IOException, ChimeraFsException, CacheException
throws ChimeraFsException, CacheException
{
if (Subjects.isRoot(subject)) {
return _fs.path2inode(path);
Expand Down Expand Up @@ -1036,7 +1036,7 @@ public void list(Subject subject, String path, Glob glob, Range<Integer> range,
}

private ExtendedInode mkdir(Subject subject, ExtendedInode parent, String name, int uid, int gid, int mode)
throws IOException, CacheException
throws ChimeraFsException, CacheException
{
if (!Subjects.isRoot(subject)) {
FileAttributes attributesOfParent
Expand Down Expand Up @@ -1065,7 +1065,7 @@ private ExtendedInode mkdir(Subject subject, ExtendedInode parent, String name,
return parent.mkdir(name, uid, gid, mode);
}

private ExtendedInode installDirectory(Subject subject, FsPath path, int uid, int gid, int mode) throws IOException, CacheException
private ExtendedInode installDirectory(Subject subject, FsPath path, int uid, int gid, int mode) throws ChimeraFsException, CacheException
{
ExtendedInode inode;
try {
Expand All @@ -1083,7 +1083,7 @@ private ExtendedInode installDirectory(Subject subject, FsPath path, int uid, in
return inode;
}

private ExtendedInode lookupDirectory(Subject subject, FsPath path) throws IOException, CacheException
private ExtendedInode lookupDirectory(Subject subject, FsPath path) throws ChimeraFsException, CacheException
{
try {
ExtendedInode inode = new ExtendedInode(pathToInode(subject, path.toString()));
Expand Down Expand Up @@ -1177,9 +1177,11 @@ public FsPath createUploadPath(Subject subject, FsPath path, FsPath rootPath,
*/
FsInode inodeOfUploadDir = installDirectory(Subjects.ROOT, uploadDirectory, 0, 0, 0711);
if (inodeOfUploadDir.statCache().getUid() != 0) {
_log.error("Owner must be root: {}", uploadDirectory);
throw new CacheException("Owner must be root: " + uploadDirectory);
}
if ((inodeOfUploadDir.statCache().getMode() & UnixPermission.S_PERMS) != 0711) {
_log.error("File mode must be 0711: {}", uploadDirectory);
throw new CacheException("File mode must be 0711: " + uploadDirectory);
}

Expand Down Expand Up @@ -1208,7 +1210,8 @@ public FsPath createUploadPath(Subject subject, FsPath path, FsPath rootPath,
_fs.mkdir(inodeOfUploadDir, uuid.toString(), uid, gid, mode, tags);

return new FsPath(uploadDirectory, uuid.toString(), path.getName());
} catch (IOException e) {
} catch (ChimeraFsException e) {
_log.error("Problem with database: {}", e.getMessage());
throw new CacheException(CacheException.UNEXPECTED_SYSTEM_EXCEPTION,
e.getMessage());
}
Expand Down

0 comments on commit c550606

Please sign in to comment.