--- gio/glocalfile.c    2011-01-06 22:13:19.000000000 -0500
+++ gio/glocalfile.c    2011-06-01 12:06:24.603474777 -0400
@@ -1719,6 +1719,8 @@
   static gsize home_dev_set = 0;
   static dev_t home_dev;
   char *topdir, *globaldir, *trashdir, *tmpname;
+  GFileInfo *dirinfo;
+  gchar *filesystem_type;
   uid_t uid;
   char uid_str[32];
   GStatBuf global_stat, trash_stat;
@@ -1737,6 +1739,20 @@
   if (dir_dev == home_dev)
     return TRUE;

+  /* We cannot trash in AFS, and it's expensive to attempt to
+   * look up the /afs/.Trash* directories.
+   */
+  dirinfo = g_file_query_filesystem_info (
+    g_file_new_for_path(dirname),
+    G_FILE_ATTRIBUTE_FILESYSTEM_TYPE,
+    NULL, NULL);
+  if (dirinfo) {
+    filesystem_type = g_strdup(g_file_info_get_attribute_string(
+      dirinfo, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE) );
+    if (strcmp (filesystem_type, "afs") == 0)
+      return FALSE;
+  }
+
   topdir = find_mountpoint_for (dirname, dir_dev);
   if (topdir == NULL)
     return FALSE;
@@ -1842,6 +1858,25 @@
     }
   else
     {
+      GFileInfo *localinfo;
+      gchar *filesystem_type;
+      /* We cannot trash in AFS, and it's expensive to attempt to
+       * look up the /afs/.Trash* directories.
+       */
+      localinfo = g_file_query_filesystem_info (
+        g_file_new_for_path(local->filename),
+        G_FILE_ATTRIBUTE_FILESYSTEM_TYPE,
+        NULL, NULL);
+      if (localinfo) {
+        filesystem_type = g_strdup(g_file_info_get_attribute_string (
+          localinfo, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE) );
+        if (strcmp (filesystem_type, "afs") == 0)
+         g_set_error_literal (error, G_IO_ERROR,
+                               G_IO_ERROR_NOT_SUPPORTED,
+                               _("trash not supported on AFS"));
+          return FALSE;
+      }
+
       uid_t uid;
       char uid_str[32];

