allow larger streams using the TDB backend
authorAndrew Tridgell <tridge@samba.org>
Mon, 26 May 2008 04:59:58 +0000 (14:59 +1000)
committerAndrew Tridgell <tridge@samba.org>
Mon, 26 May 2008 04:59:58 +0000 (14:59 +1000)
(This used to be commit 8c0d756eb887477da867e069dbde3a7ad98d4ae0)

source4/librpc/idl/xattr.idl
source4/ntvfs/posix/pvfs_streams.c

index 2010d51ce10fc2562ed6b64f44cf47ad3937299d..520341e6aaf1ddb9592aa46ccfbfbe3875889da1 100644 (file)
@@ -86,7 +86,8 @@ interface xattr
        /* stream data is stored in attributes with the given prefix */
        const char *XATTR_DOSSTREAM_PREFIX = "user.DosStream.";
 
        /* stream data is stored in attributes with the given prefix */
        const char *XATTR_DOSSTREAM_PREFIX = "user.DosStream.";
 
-       const int XATTR_MAX_STREAM_SIZE = 0x4000;
+       const int XATTR_MAX_STREAM_SIZE     = 0x4000;
+       const int XATTR_MAX_STREAM_SIZE_TDB = 0x100000;
 
        typedef struct {
                uint32     flags;
 
        typedef struct {
                uint32     flags;
index 3cd9952fd5bcc73d308daa601c629f7af05d34a2..30d7ce247723935dfdbb3ed5498e18e71181154a 100644 (file)
@@ -276,9 +276,12 @@ ssize_t pvfs_stream_write(struct pvfs_state *pvfs,
        if (count == 0) {
                return 0;
        }
        if (count == 0) {
                return 0;
        }
-       if (offset > XATTR_MAX_STREAM_SIZE) {
-               errno = ENOSPC;
-               return -1;
+
+       if (count+offset > XATTR_MAX_STREAM_SIZE) {
+               if (!pvfs->ea_db || count+offset > XATTR_MAX_STREAM_SIZE_TDB) {
+                       errno = ENOSPC;
+                       return -1;
+               }
        }
 
        /* we have to load the existing stream, then modify, then save */
        }
 
        /* we have to load the existing stream, then modify, then save */
@@ -332,7 +335,9 @@ NTSTATUS pvfs_stream_truncate(struct pvfs_state *pvfs,
        DATA_BLOB blob;
 
        if (length > XATTR_MAX_STREAM_SIZE) {
        DATA_BLOB blob;
 
        if (length > XATTR_MAX_STREAM_SIZE) {
-               return NT_STATUS_DISK_FULL;
+               if (!pvfs->ea_db || length > XATTR_MAX_STREAM_SIZE_TDB) {
+                       return NT_STATUS_DISK_FULL;
+               }
        }
 
        /* we have to load the existing stream, then modify, then save */
        }
 
        /* we have to load the existing stream, then modify, then save */