From 96a9a5982256608086c7c52049f6638cefe8d049 Mon Sep 17 00:00:00 2001 From: Uma Maheswara Rao G Date: Thu, 23 Jan 2014 16:39:18 +0000 Subject: [PATCH] Merge HDFS-5789. Some of snapshot APIs missing checkOperation double check in fsn. Contributed by Uma Maheswara Rao G. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1560732 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 2 ++ .../org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index b26f1ac364b..9137b7498e8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -836,6 +836,8 @@ Release 2.3.0 - UNRELEASED HDFS-5649. Unregister NFS and Mount service when NFS gateway is shutting down. (brandonli) + HDFS-5789. Some of snapshot APIs missing checkOperation double check in fsn. (umamahesh) + Release 2.2.0 - 2013-10-13 INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java index d1f0234fcac..2321ceffaa0 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java @@ -6777,6 +6777,7 @@ public class FSNamesystem implements Namesystem, FSClusterStats, /** Allow snapshot on a directroy. */ void allowSnapshot(String path) throws SafeModeException, IOException { + checkOperation(OperationCategory.WRITE); writeLock(); try { checkOperation(OperationCategory.WRITE); @@ -6802,6 +6803,7 @@ public class FSNamesystem implements Namesystem, FSClusterStats, /** Disallow snapshot on a directory. */ void disallowSnapshot(String path) throws SafeModeException, IOException { + checkOperation(OperationCategory.WRITE); writeLock(); try { checkOperation(OperationCategory.WRITE); @@ -6925,6 +6927,7 @@ public class FSNamesystem implements Namesystem, FSClusterStats, public SnapshottableDirectoryStatus[] getSnapshottableDirListing() throws IOException { SnapshottableDirectoryStatus[] status = null; + checkOperation(OperationCategory.READ); final FSPermissionChecker checker = getPermissionChecker(); readLock(); try { @@ -6958,6 +6961,7 @@ public class FSNamesystem implements Namesystem, FSClusterStats, SnapshotDiffReport getSnapshotDiffReport(String path, String fromSnapshot, String toSnapshot) throws IOException { SnapshotDiffInfo diffs = null; + checkOperation(OperationCategory.READ); final FSPermissionChecker pc = getPermissionChecker(); readLock(); try {