mutex_lock(&inode->log_mutex);
        }
 
+       /*
+        * For symlinks, we must always log their content, which is stored in an
+        * inline extent, otherwise we could end up with an empty symlink after
+        * log replay, which is invalid on linux (symlink(2) returns -ENOENT if
+        * one attempts to create an empty symlink).
+        * We don't need to worry about flushing delalloc, because when we create
+        * the inline extent when the symlink is created (we never have delalloc
+        * for symlinks).
+        */
+       if (S_ISLNK(inode->vfs_inode.i_mode))
+               inode_only = LOG_INODE_ALL;
+
        /*
         * Before logging the inode item, cache the value returned by
         * inode_logged(), because after that we have the need to figure out if
                        }
 
                        ctx->log_new_dentries = false;
-                       if (type == BTRFS_FT_DIR || type == BTRFS_FT_SYMLINK)
+                       if (type == BTRFS_FT_DIR)
                                log_mode = LOG_INODE_ALL;
                        ret = btrfs_log_inode(trans, BTRFS_I(di_inode),
                                              log_mode, ctx);