Fix ContainerLocalizer permission bug by also deleting filecache folder
Signed-off-by: Shanyu Zhao <shzhao@microsoft.com>
This commit is contained in:
parent
29242a6a7a
commit
beca49dfbf
|
@ -316,27 +316,35 @@ public class SecureModeLocalUserAllocator {
|
||||||
String localUser = appUserToLocalUser.remove(appUser).localUser;
|
String localUser = appUserToLocalUser.remove(appUser).localUser;
|
||||||
allocated.set(localUserInfo.localUserIndex, false);
|
allocated.set(localUserInfo.localUserIndex, false);
|
||||||
if (delService != null) {
|
if (delService != null) {
|
||||||
// check if node manager usercache/<appUser>/appcache folder exists
|
// check and delete these node manager folders, which will cause permission issues later:
|
||||||
|
// usercache/<appUser>/appcache
|
||||||
|
// usercache/<appUser>/filecche
|
||||||
for (String localDir : nmLocalDirs) {
|
for (String localDir : nmLocalDirs) {
|
||||||
Path usersDir = new Path(localDir, ContainerLocalizer.USERCACHE);
|
Path usersDir = new Path(localDir, ContainerLocalizer.USERCACHE);
|
||||||
Path userDir = new Path(usersDir, appUser);
|
Path userDir = new Path(usersDir, appUser);
|
||||||
Path userAppCacheDir = new Path(userDir, ContainerLocalizer.APPCACHE);
|
Path userAppCacheDir = new Path(userDir, ContainerLocalizer.APPCACHE);
|
||||||
FileStatus status;
|
Path userFileCacheDir = new Path(userDir, ContainerLocalizer.FILECACHE);
|
||||||
try {
|
ArrayList<Path> toDelete = new ArrayList<Path>();
|
||||||
status = lfs.getFileStatus(userAppCacheDir);
|
toDelete.add(userAppCacheDir);
|
||||||
}
|
toDelete.add(userFileCacheDir);
|
||||||
catch(FileNotFoundException fs) {
|
|
||||||
status = null;
|
for (Path dir : toDelete) {
|
||||||
}
|
FileStatus status = null;
|
||||||
catch(IOException ie) {
|
try {
|
||||||
String msg = "Could not get file status for local dir " + userDir;
|
status = lfs.getFileStatus(userAppCacheDir);
|
||||||
LOG.warn(msg, ie);
|
}
|
||||||
throw new YarnRuntimeException(msg, ie);
|
catch(FileNotFoundException fs) {
|
||||||
}
|
}
|
||||||
if (status != null) {
|
catch(IOException ie) {
|
||||||
FileDeletionTask delTask = new FileDeletionTask(delService, localUser,
|
String msg = "Could not get file status for local dir " + dir;
|
||||||
userAppCacheDir, null);
|
LOG.warn(msg, ie);
|
||||||
delService.delete(delTask);
|
throw new YarnRuntimeException(msg, ie);
|
||||||
|
}
|
||||||
|
if (status != null) {
|
||||||
|
FileDeletionTask delTask = new FileDeletionTask(delService, localUser,
|
||||||
|
dir, null);
|
||||||
|
delService.delete(delTask);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -344,4 +352,4 @@ public class SecureModeLocalUserAllocator {
|
||||||
" for appUser " + appUser);
|
" for appUser " + appUser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue