if (mode == metadata.getStats().getMode())
return 0;
try {
FileStats fs = metadata.getStats();
fs.setMode(mode);
NodeMetadata node = new NodeMetadata(metadata.getNodeType(), metadata.getParent(), metadata.getName(), fs, metadata.getId_path(), metadata.getKey(), ((mode & SCFSConstants.S_IRGRP) == 0 && (mode & SCFSConstants.S_IROTH) == 0) ? new int[] { clientId } : null, metadata.getC_w());
if(isInPNS){
namespace.updateMetadata(path, node);
}else{
long time = System.currentTimeMillis();
directoryService.updateMetadata(path, node);
Statistics.incUpdateMeta(System.currentTimeMillis() - time);
}
} catch (DirectoryServiceConnectionProblemException e) {
throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
} catch (DirectoryServiceException e) {
e.printStackTrace();
throw new FuseException(e.getMessage()).initErrno(FuseException.ECONNABORTED);
}
}else{
try {
long time = System.currentTimeMillis();
metadata = directoryService.getMetadata(path);
Statistics.incGetMeta(System.currentTimeMillis() - time);
if (mode == metadata.getStats().getMode())
return 0;
FileStats fs = metadata.getStats();
fs.setMode(mode);
NodeMetadata node = new NodeMetadata(metadata.getNodeType(), metadata.getParent(), metadata.getName(), fs, metadata.getId_path(), metadata.getKey(), ((mode & SCFSConstants.S_IRGRP) == 0 && (mode & SCFSConstants.S_IROTH) == 0) ? new int[] { clientId } : null, metadata.getC_w());
time = System.currentTimeMillis();
directoryService.updateMetadata(path, node);
Statistics.incUpdateMeta(System.currentTimeMillis() - time);